├── aivctrl ├── install │ ├── pi32 │ │ ├── Output │ │ │ ├── debian │ │ │ │ └── DEBIAN │ │ │ │ │ ├── prerm │ │ │ │ │ ├── postinst │ │ │ │ │ ├── postrm │ │ │ │ │ └── control │ │ │ ├── usr │ │ │ │ └── bin │ │ │ │ │ └── dummy │ │ │ ├── aivctrl.desktop │ │ │ ├── aivctrl.run.desktop │ │ │ └── doc.txt │ │ ├── aivctrl │ │ ├── raspberry pi3 installation notes.txt │ │ ├── readme │ │ └── build.sh │ ├── linux64 │ │ ├── Output │ │ │ ├── debian │ │ │ │ ├── DEBIAN │ │ │ │ │ ├── prerm │ │ │ │ │ ├── postinst │ │ │ │ │ ├── postrm │ │ │ │ │ └── control │ │ │ │ └── usr │ │ │ │ │ └── bin │ │ │ │ │ └── dummy │ │ │ ├── aivctrl.run.desktop │ │ │ ├── aivctrl.desktop │ │ │ └── doc.txt │ │ ├── aivctrlzip │ │ ├── aivctrl │ │ └── readme │ ├── win32 │ │ ├── build │ │ │ └── dummy │ │ ├── Output │ │ │ └── dummy │ │ ├── aivctrl.iss │ │ ├── buildQt5123-Mingw73-32.cmd │ │ ├── buildQt5123-Mingw73-64.cmd │ │ ├── build-Qt5123-Mingw73.cmd │ │ ├── readme.txt │ │ ├── build-Qt5123-Mingw73-internal.cmd │ │ └── build-Qt580-Mingw53.cmd │ └── macos │ │ ├── Output │ │ └── dummy │ │ └── deployt.sh ├── doc │ ├── en.docx │ └── fr.docx ├── icons │ ├── qt.png │ ├── about.png │ ├── audio.png │ ├── genre.png │ ├── home.png │ ├── image.png │ ├── next.png │ ├── queue.png │ ├── text.png │ ├── video.png │ ├── artist.png │ ├── bookmark.png │ ├── delete.png │ ├── device.png │ ├── favorite.png │ ├── folder.png │ ├── language.png │ ├── playlist.png │ ├── previous.png │ ├── rename.png │ ├── renderer.png │ ├── search.png │ ├── search16.png │ ├── server.png │ ├── settings.png │ ├── add_queue.png │ ├── aivctrl48.ico │ ├── aivctrl48.png │ ├── aivctrl64.icns │ ├── aivctrl64.png │ ├── discovery0.png │ ├── favorites.png │ ├── network16.png │ ├── playing_on.png │ ├── repeat_all.png │ ├── repeat_off.png │ ├── repeat_one.png │ ├── shuffle_on.png │ ├── speaker_on.png │ ├── add_favorites.png │ ├── add_playlist.png │ ├── discovery15.png │ ├── discovery30.png │ ├── favorite_true.png │ ├── music_album.png │ ├── no_album_art.png │ ├── photo_album.png │ ├── playing_off.png │ ├── replace_queue.png │ ├── search_cancel.png │ ├── shuffle_off.png │ ├── speaker_off.png │ ├── audio_file_big.png │ ├── current_playing.png │ ├── previous_folder.png │ └── contextual_actions.png ├── languages │ ├── en.png │ ├── fr.png │ └── aivctrl_fr.qm ├── main.cpp ├── about.cpp ├── about.hpp ├── aivwidgets │ ├── cloudbrowser.cpp │ ├── listwidgetbase.cpp │ ├── slider.hpp │ ├── cloudbrowser.hpp │ ├── textmetadata.hpp │ ├── listwidgetbase.hpp │ ├── position.hpp │ ├── cover.hpp │ ├── upnpwidgets.pro │ ├── cover.cpp │ ├── devicebrowser.hpp │ ├── position.cpp │ ├── playlistbrowser.hpp │ ├── textmetadata.cpp │ ├── widgethelper.hpp │ ├── networkprogress.hpp │ └── slider.cpp ├── aivctrl.rc ├── xmlhplaylist.hpp ├── playlistchoice.hpp ├── language.hpp ├── settings.hpp ├── helper.hpp ├── session.hpp ├── playlistchoice.cpp ├── sliderslots.cpp ├── helper.cpp ├── language.ui ├── icons.cpp ├── aivctrl.qrc ├── settings.cpp ├── aivctrl.pro ├── serverscanner.hpp ├── language.cpp └── playlistchoice.ui ├── upnp ├── Doc │ ├── html.zip │ └── upnp-av-schema.jpg ├── using_upnp_namespace.hpp ├── upnp_global.hpp ├── dump.cpp ├── avcontrol.cpp ├── control.cpp ├── waitingloop.cpp ├── unicastsocket.hpp ├── xmlhaction.cpp ├── unicastsocket.cpp ├── waitingloop.hpp ├── action.cpp ├── multicastsocket.hpp ├── initialdiscovery.cpp ├── xmlhaction.hpp ├── xmlhevent.hpp ├── dump.hpp ├── action.hpp ├── xmlhevent.cpp ├── transportsettings.hpp ├── control.hpp ├── argument.cpp ├── argument.hpp ├── xmlhdidllite.hpp ├── devicecaps.hpp ├── xmlhservice.hpp ├── connectionmanager.hpp ├── multicastsocket.cpp ├── avcontrol.hpp ├── transportsettings.cpp ├── transportinfo.hpp ├── xmlhdevice.hpp ├── devicecaps.cpp ├── transportinfo.cpp ├── devicepixmap.hpp ├── xmlhdidllite.cpp ├── datacaller.hpp ├── connectioninfo.hpp ├── positioninfo.hpp ├── didlitem_playlist.cpp ├── datacaller.cpp ├── devicepixmap.cpp ├── initialdiscovery.hpp ├── actioninfo.hpp ├── aes256.h ├── mediainfo.hpp ├── connectionmanager.cpp ├── actionmanager.hpp ├── status.hpp └── connectioninfo.cpp ├── QtUPnP.pro ├── chupnp ├── resources │ ├── arrow.png │ ├── audio.png │ ├── image.png │ ├── video.png │ ├── folder.png │ ├── server.png │ ├── unknown.png │ ├── container.png │ ├── renderer.png │ ├── music_album.png │ ├── otherdevices.png │ └── photo_album.png ├── docs │ └── Test QtUPnP with chupnp.pdf ├── main.cpp ├── item.cpp ├── chupnp.qrc ├── search.hpp ├── helper.hpp ├── item.hpp ├── search.cpp ├── stdaction.hpp ├── chupnp.pro ├── actionParams.hpp ├── search.ui └── stdaction.ui ├── googledrive ├── dep.cmd ├── googledrive.png ├── dep.sh ├── depmac.sh ├── googledrive.ids ├── googledrive_global.hpp └── googledrive.pro ├── readme-images ├── aivctrl.png └── chupnp.png ├── .gitignore ├── aivctrl.pro ├── linux-build ├── QtUPnP-fedora.sh ├── aivctrl-fedora.sh ├── QtUPnP.sh ├── aivctrl.sh └── doc.txt ├── caes256 ├── mainwindow.hpp ├── main.cpp ├── caes256.pro └── mainwindow.cpp ├── license.txt └── changelog /aivctrl/install/pi32/Output/debian/DEBIAN/prerm: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /aivctrl/install/linux64/Output/debian/DEBIAN/prerm: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /aivctrl/install/win32/build/dummy: -------------------------------------------------------------------------------- 1 | To simulate an empty directory -------------------------------------------------------------------------------- /aivctrl/install/macos/Output/dummy: -------------------------------------------------------------------------------- 1 | To simulate an empty directory -------------------------------------------------------------------------------- /aivctrl/install/win32/Output/dummy: -------------------------------------------------------------------------------- 1 | To simulate an empty directory -------------------------------------------------------------------------------- /aivctrl/install/pi32/Output/usr/bin/dummy: -------------------------------------------------------------------------------- 1 | To simulate an empty directory -------------------------------------------------------------------------------- /aivctrl/install/linux64/Output/debian/usr/bin/dummy: -------------------------------------------------------------------------------- 1 | To simulate an empty directory -------------------------------------------------------------------------------- /upnp/Doc/html.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/upnp/Doc/html.zip -------------------------------------------------------------------------------- /aivctrl/doc/en.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/doc/en.docx -------------------------------------------------------------------------------- /aivctrl/doc/fr.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/doc/fr.docx -------------------------------------------------------------------------------- /aivctrl/icons/qt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/qt.png -------------------------------------------------------------------------------- /aivctrl/icons/about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/about.png -------------------------------------------------------------------------------- /aivctrl/icons/audio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/audio.png -------------------------------------------------------------------------------- /aivctrl/icons/genre.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/genre.png -------------------------------------------------------------------------------- /aivctrl/icons/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/home.png -------------------------------------------------------------------------------- /aivctrl/icons/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/image.png -------------------------------------------------------------------------------- /aivctrl/icons/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/next.png -------------------------------------------------------------------------------- /aivctrl/icons/queue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/queue.png -------------------------------------------------------------------------------- /aivctrl/icons/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/text.png -------------------------------------------------------------------------------- /aivctrl/icons/video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/video.png -------------------------------------------------------------------------------- /QtUPnP.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | CONFIG += ordered 4 | 5 | SUBDIRS += upnp chupnp 6 | 7 | -------------------------------------------------------------------------------- /aivctrl/icons/artist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/artist.png -------------------------------------------------------------------------------- /aivctrl/icons/bookmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/bookmark.png -------------------------------------------------------------------------------- /aivctrl/icons/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/delete.png -------------------------------------------------------------------------------- /aivctrl/icons/device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/device.png -------------------------------------------------------------------------------- /aivctrl/icons/favorite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/favorite.png -------------------------------------------------------------------------------- /aivctrl/icons/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/folder.png -------------------------------------------------------------------------------- /aivctrl/icons/language.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/language.png -------------------------------------------------------------------------------- /aivctrl/icons/playlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/playlist.png -------------------------------------------------------------------------------- /aivctrl/icons/previous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/previous.png -------------------------------------------------------------------------------- /aivctrl/icons/rename.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/rename.png -------------------------------------------------------------------------------- /aivctrl/icons/renderer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/renderer.png -------------------------------------------------------------------------------- /aivctrl/icons/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/search.png -------------------------------------------------------------------------------- /aivctrl/icons/search16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/search16.png -------------------------------------------------------------------------------- /aivctrl/icons/server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/server.png -------------------------------------------------------------------------------- /aivctrl/icons/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/settings.png -------------------------------------------------------------------------------- /aivctrl/languages/en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/languages/en.png -------------------------------------------------------------------------------- /aivctrl/languages/fr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/languages/fr.png -------------------------------------------------------------------------------- /chupnp/resources/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/chupnp/resources/arrow.png -------------------------------------------------------------------------------- /chupnp/resources/audio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/chupnp/resources/audio.png -------------------------------------------------------------------------------- /chupnp/resources/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/chupnp/resources/image.png -------------------------------------------------------------------------------- /chupnp/resources/video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/chupnp/resources/video.png -------------------------------------------------------------------------------- /googledrive/dep.cmd: -------------------------------------------------------------------------------- 1 | echo off 2 | copy /Y %1\*.png %2 3 | copy /Y %1\*.ids %2 4 | del %2\libgoogledrive.a -------------------------------------------------------------------------------- /readme-images/aivctrl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/readme-images/aivctrl.png -------------------------------------------------------------------------------- /readme-images/chupnp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/readme-images/chupnp.png -------------------------------------------------------------------------------- /aivctrl/icons/add_queue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/add_queue.png -------------------------------------------------------------------------------- /aivctrl/icons/aivctrl48.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/aivctrl48.ico -------------------------------------------------------------------------------- /aivctrl/icons/aivctrl48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/aivctrl48.png -------------------------------------------------------------------------------- /aivctrl/icons/aivctrl64.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/aivctrl64.icns -------------------------------------------------------------------------------- /aivctrl/icons/aivctrl64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/aivctrl64.png -------------------------------------------------------------------------------- /aivctrl/icons/discovery0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/discovery0.png -------------------------------------------------------------------------------- /aivctrl/icons/favorites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/favorites.png -------------------------------------------------------------------------------- /aivctrl/icons/network16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/network16.png -------------------------------------------------------------------------------- /aivctrl/icons/playing_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/playing_on.png -------------------------------------------------------------------------------- /aivctrl/icons/repeat_all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/repeat_all.png -------------------------------------------------------------------------------- /aivctrl/icons/repeat_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/repeat_off.png -------------------------------------------------------------------------------- /aivctrl/icons/repeat_one.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/repeat_one.png -------------------------------------------------------------------------------- /aivctrl/icons/shuffle_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/shuffle_on.png -------------------------------------------------------------------------------- /aivctrl/icons/speaker_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/speaker_on.png -------------------------------------------------------------------------------- /chupnp/resources/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/chupnp/resources/folder.png -------------------------------------------------------------------------------- /chupnp/resources/server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/chupnp/resources/server.png -------------------------------------------------------------------------------- /chupnp/resources/unknown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/chupnp/resources/unknown.png -------------------------------------------------------------------------------- /googledrive/googledrive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/googledrive/googledrive.png -------------------------------------------------------------------------------- /upnp/Doc/upnp-av-schema.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/upnp/Doc/upnp-av-schema.jpg -------------------------------------------------------------------------------- /aivctrl/icons/add_favorites.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/add_favorites.png -------------------------------------------------------------------------------- /aivctrl/icons/add_playlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/add_playlist.png -------------------------------------------------------------------------------- /aivctrl/icons/discovery15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/discovery15.png -------------------------------------------------------------------------------- /aivctrl/icons/discovery30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/discovery30.png -------------------------------------------------------------------------------- /aivctrl/icons/favorite_true.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/favorite_true.png -------------------------------------------------------------------------------- /aivctrl/icons/music_album.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/music_album.png -------------------------------------------------------------------------------- /aivctrl/icons/no_album_art.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/no_album_art.png -------------------------------------------------------------------------------- /aivctrl/icons/photo_album.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/photo_album.png -------------------------------------------------------------------------------- /aivctrl/icons/playing_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/playing_off.png -------------------------------------------------------------------------------- /aivctrl/icons/replace_queue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/replace_queue.png -------------------------------------------------------------------------------- /aivctrl/icons/search_cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/search_cancel.png -------------------------------------------------------------------------------- /aivctrl/icons/shuffle_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/shuffle_off.png -------------------------------------------------------------------------------- /aivctrl/icons/speaker_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/speaker_off.png -------------------------------------------------------------------------------- /aivctrl/install/linux64/aivctrlzip: -------------------------------------------------------------------------------- 1 | export LD_LIBRARY_PATH=/usr/bin/aivctrl/lib:$LD_LIBRARY_PATH 2 | ./aivctrl 3 | -------------------------------------------------------------------------------- /aivctrl/languages/aivctrl_fr.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/languages/aivctrl_fr.qm -------------------------------------------------------------------------------- /chupnp/resources/container.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/chupnp/resources/container.png -------------------------------------------------------------------------------- /chupnp/resources/renderer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/chupnp/resources/renderer.png -------------------------------------------------------------------------------- /aivctrl/icons/audio_file_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/audio_file_big.png -------------------------------------------------------------------------------- /aivctrl/icons/current_playing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/current_playing.png -------------------------------------------------------------------------------- /aivctrl/icons/previous_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/previous_folder.png -------------------------------------------------------------------------------- /aivctrl/install/win32/aivctrl.iss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/install/win32/aivctrl.iss -------------------------------------------------------------------------------- /chupnp/resources/music_album.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/chupnp/resources/music_album.png -------------------------------------------------------------------------------- /chupnp/resources/otherdevices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/chupnp/resources/otherdevices.png -------------------------------------------------------------------------------- /chupnp/resources/photo_album.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/chupnp/resources/photo_album.png -------------------------------------------------------------------------------- /aivctrl/icons/contextual_actions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/aivctrl/icons/contextual_actions.png -------------------------------------------------------------------------------- /aivctrl/install/pi32/aivctrl: -------------------------------------------------------------------------------- 1 | export LD_LIBRARY_PATH=/usr/bin/aivctrl/lib:$LD_LIBRARY_PATH 2 | /usr/bin/aivctrl/aivctrl 3 | -------------------------------------------------------------------------------- /aivctrl/install/linux64/aivctrl: -------------------------------------------------------------------------------- 1 | export LD_LIBRARY_PATH=/usr/bin/aivctrl/lib:$LD_LIBRARY_PATH 2 | /usr/bin/aivctrl/aivctrl 3 | -------------------------------------------------------------------------------- /chupnp/docs/Test QtUPnP with chupnp.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ptstream/QtUPnP/HEAD/chupnp/docs/Test QtUPnP with chupnp.pdf -------------------------------------------------------------------------------- /aivctrl/install/win32/buildQt5123-Mingw73-32.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Define 32 bits plateform. 3 | set PLATEFORM=32 4 | call build-Qt5123-Mingw73.cmd 5 | -------------------------------------------------------------------------------- /aivctrl/install/win32/buildQt5123-Mingw73-64.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Define 64 bits plateform. 3 | set PLATEFORM=64 4 | call build-Qt5123-Mingw73.cmd 5 | -------------------------------------------------------------------------------- /aivctrl/install/pi32/Output/debian/DEBIAN/postinst: -------------------------------------------------------------------------------- 1 | if [ -f /usr/bin/aivctrl/aivctrl.desktop ]; 2 | then 3 | sudo cp /usr/bin/aivctrl/aivctrl.desktop /usr/share/applications 4 | fi 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pro.user 2 | *.bak 3 | *.deb 4 | *.zip 5 | *.dmg 6 | aivctrl/install/linux64/Output/debian/usr/bin/aivctrl 7 | aivctrl/install/win32/Output/*.exe 8 | aivctrl/install/pi32/Output/debian/usr/bin/aivctrl -------------------------------------------------------------------------------- /googledrive/dep.sh: -------------------------------------------------------------------------------- 1 | echo "plugin dependencies" 2 | cp $1/googledrive.png $2googledrive.png 3 | cp $1/googledrive.ids $2googledrive.ids 4 | mv $2/libgoogledrive.so.1.0.0 $2googledrive.so 5 | rm $2libgoogledrive.* -------------------------------------------------------------------------------- /googledrive/depmac.sh: -------------------------------------------------------------------------------- 1 | echo "plugin dependencies" 2 | cp $1/googledrive.png $2googledrive.png 3 | cp $1/googledrive.ids $2googledrive.ids 4 | mv $2/libgoogledrive.dylib $2googledrive.dylib 5 | rm $2libgoogledrive.* -------------------------------------------------------------------------------- /aivctrl.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS += upnp \ 4 | googledrive \ 5 | aivctrl 6 | 7 | CONFIG += ordered 8 | TRANSLATIONS = $$PWD/aivctrl/languages/aivctrl_fr.ts 9 | 10 | -------------------------------------------------------------------------------- /chupnp/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.hpp" 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | QApplication a(argc, argv); 7 | CMainWindow w; 8 | w.show(); 9 | return a.exec (); 10 | } 11 | -------------------------------------------------------------------------------- /aivctrl/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.hpp" 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | QApplication a (argc, argv); 7 | CMainWindow w; 8 | QIcon icon (":/icons/aivctrl48.ico"); 9 | w.setWindowIcon (icon); 10 | w.show (); 11 | return a.exec(); 12 | } 13 | -------------------------------------------------------------------------------- /linux-build/QtUPnP-fedora.sh: -------------------------------------------------------------------------------- 1 | # Build and launch chupnp on fedora 2 | 3 | # Get qmake location 4 | QMAKE=$(which qmake-qt5) 5 | 6 | # Create the Linux Makefile 7 | $QMAKE ../QtUPnP.pro 8 | 9 | # Build chupnp 10 | make -j$(nproc) 11 | 12 | # Launch chupnp 13 | chupnp/chupnp 14 | -------------------------------------------------------------------------------- /linux-build/aivctrl-fedora.sh: -------------------------------------------------------------------------------- 1 | # Build and launch aivctrl on fedora 2 | 3 | # Get qmake location 4 | QMAKE=$(which qmake-qt5) 5 | 6 | # Create the Linux Makefile 7 | $QMAKE ../aivctrl.pro 8 | 9 | # Build chupnp 10 | make -j$(nproc) 11 | 12 | # Launch aivctrl 13 | aivctrl/aivctrl 14 | -------------------------------------------------------------------------------- /aivctrl/install/linux64/Output/aivctrl.run.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Version=1.1.4 4 | Name=AIVCtrl 5 | GenericName=AIVCtrl 6 | Exec=aivctrl.run 7 | Comment=AIVCtrl - An UPnP/AV control point 8 | Icon=/usr/bin/aivctrl/aivctrl48.png 9 | Terminal=false 10 | Categories=Qt;AudioVideo;Audio;Player; 11 | 12 | -------------------------------------------------------------------------------- /aivctrl/install/pi32/Output/aivctrl.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Version=1.1.2 4 | Name=AIVCtrl 5 | GenericName=AIVCtrl 6 | Exec=/usr/bin/aivctrl/aivctrl 7 | Comment=AIVCtrl - An UPnP/AV control point 8 | Icon=/usr/bin/aivctrl/aivctrl48.png 9 | Terminal=false 10 | Categories=Qt;AudioVideo;Audio;Player; 11 | 12 | -------------------------------------------------------------------------------- /chupnp/item.cpp: -------------------------------------------------------------------------------- 1 | #include "item.hpp" 2 | 3 | CItem::CItem (QTreeWidgetItem* item, CDidlItem const & didl, EItemType type) : 4 | QTreeWidgetItem (item, type), m_didl (didl) 5 | { 6 | CDidlElem const & elem = didl.value ("dc:title"); 7 | QString title = elem.value (); 8 | setText (0, title); 9 | } 10 | -------------------------------------------------------------------------------- /aivctrl/install/pi32/Output/aivctrl.run.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Version=1.1.2 4 | Name=AIVCtrl 5 | GenericName=AIVCtrl 6 | Exec=/usr/bin/aivctrl/aivctrl 7 | Comment=AIVCtrl - An UPnP/AV control point 8 | Icon=/usr/bin/aivctrl/aivctrl48.png 9 | Terminal=false 10 | Categories=Qt;AudioVideo;Audio;Player; 11 | 12 | -------------------------------------------------------------------------------- /aivctrl/install/linux64/Output/aivctrl.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Version=1.1.4 4 | Name=AIVCtrl 5 | GenericName=AIVCtrl 6 | Exec=/usr/bin/aivctrl/aivctrl.run 7 | Comment=AIVCtrl - An UPnP/AV control point 8 | Icon=/usr/bin/aivctrl/aivctrl48.png 9 | Terminal=false 10 | Categories=Qt;AudioVideo;Audio;Player; 11 | 12 | -------------------------------------------------------------------------------- /upnp/using_upnp_namespace.hpp: -------------------------------------------------------------------------------- 1 | #ifndef USING_UPNP_NAMESPACE_HPP 2 | #define USING_UPNP_NAMESPACE_HPP 1 3 | 4 | /*! Defines namespace macros. */ 5 | 6 | #define USING_UPNP_NAMESPACE using namespace QtUPnP; //!< Helper to using QtUPnP namespace 7 | #define START_DEFINE_UPNP_NAMESPACE namespace QtUPnP { //!< Helper to define QtUPnP namespace 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /upnp/upnp_global.hpp: -------------------------------------------------------------------------------- 1 | #ifndef UPNP_GLOBAL_H 2 | #define UPNP_GLOBAL_H 1 3 | 4 | /*! Defines export or import keyword for windows dll. */ 5 | 6 | #ifdef _OS_WIN 7 | 8 | #ifdef UPNP_EXPORTS 9 | #define UPNP_API __declspec(dllexport) 10 | #else 11 | #define UPNP_API __declspec(dllimport) 12 | #endif 13 | 14 | #else 15 | #define UPNP_API 16 | #endif 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /aivctrl/install/pi32/raspberry pi3 installation notes.txt: -------------------------------------------------------------------------------- 1 | Raspberry PI3 installation 2 | 3 | * Install Qt5.7 packages 4 | sudo apt-get install qt5-default 5 | 6 | * Intall the aivctrl package 7 | sudo dpkg -i aivctrl-pi3-.deb 8 | 9 | An entry is created in your multimedia sub-menu. 10 | 11 | To uninstall the package 12 | sudo apt-get remove aivctrl 13 | -------------------------------------------------------------------------------- /aivctrl/install/linux64/Output/debian/DEBIAN/postinst: -------------------------------------------------------------------------------- 1 | sudo cp /usr/bin/aivctrl/aivctrl.desktop /usr/share/applications 2 | sudo chmod -R +r /usr/bin/aivctrl 3 | sudo chmod +rx /usr/share/applications/aivctrl.desktop 4 | sudo chmod +rx /usr/bin/aivctrl/aivctrl.desktop 5 | sudo chmod +rx /usr/bin/aivctrl/aivctrl 6 | sudo chmod +rx /usr/bin/aivctrl/aivctrl.run 7 | sudo chmod +rx /usr/bin/aivctrl/aivctrl.run.desktop 8 | -------------------------------------------------------------------------------- /aivctrl/install/win32/build-Qt5123-Mingw73.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem Qt installation folder. 4 | set QTDIR=C:\Qt\Qt5.12.3\5.12.3\mingw73_%PLATEFORM% 5 | 6 | rem The QtUPnP folder. 7 | set DEVELDIR=C:\Users\%USERNAME%\Documents\Development 8 | 9 | rem Compilation results. 10 | set BINARIES=%DEVELDIR%\build-aivctrl-Desktop_Qt_5_12_3_MinGW_%PLATEFORM%_bit-Release 11 | 12 | call build-Qt5123-Mingw73-internal.cmd -------------------------------------------------------------------------------- /aivctrl/about.cpp: -------------------------------------------------------------------------------- 1 | #include "about.hpp" 2 | #include "ui_about.h" 3 | #include "aivwidgets/widgethelper.hpp" 4 | 5 | CAbout::CAbout (QWidget* parent) : QDialog (parent), ui (new Ui::CAbout) 6 | { 7 | removeWindowContextHelpButton (this); 8 | ui->setupUi (this); 9 | } 10 | 11 | CAbout::~CAbout () 12 | { 13 | delete ui; 14 | } 15 | 16 | void CAbout::on_m_close_clicked () 17 | { 18 | accept (); 19 | } 20 | -------------------------------------------------------------------------------- /aivctrl/install/win32/readme.txt: -------------------------------------------------------------------------------- 1 | To create an Windows installer an InnoSetup script is provided. 2 | 3 | 1. Install InnoSetup e.g. http://www.jrsoftware.org/isinfo.php 4 | 2. Launch build.cmd to create the "build" folder containing all files to run AIVCtrl. At this stage double click on aivctrl.exe 5 | start the application. 6 | 3. Launch InnoSetup with the file aivctrl.iss. An installer is created in Ouput folder. 7 | 8 | 9 | -------------------------------------------------------------------------------- /googledrive/googledrive.ids: -------------------------------------------------------------------------------- 1 | 2 | 3 | googledrive 4 | uuid:6a9ab8a8-f496-451b-8a86-1a146ed92aac 5 | 6 | rZ651lUvk13104yvBVnppOaah8CAHPlOkFZBYzIaI4B3FvF9KL6wB78T5NwQwqqqlumpp+9zniL1IzIGQHlM7ttd7z6jQ7Z/af/L9EJLHb6W6amn73OeIvUjMgZAeUzu 7 | aQjk7vKfxRtZXy3w/HyOboffie2SE6AEqTgvFQopGrc= 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /googledrive/googledrive_global.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GOOGLEDRIVE_GLOBAL_HPP 2 | #define GOOGLEDRIVE_GLOBAL_HPP 3 | 4 | #include 5 | 6 | #ifdef _OS_WIN 7 | 8 | #if defined(GOOGLEDRIVE_LIBRARY) 9 | #define GOOGLEDRIVESHARED_EXPORT Q_DECL_EXPORT 10 | #else 11 | #define GOOGLEDRIVESHARED_EXPORT Q_DECL_IMPORT 12 | #endif 13 | 14 | 15 | #else 16 | #define GOOGLEDRIVESHARED_EXPORT 17 | #endif 18 | 19 | #endif // GOOGLEDRIVE_GLOBAL_HPP 20 | -------------------------------------------------------------------------------- /aivctrl/about.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ABOUT_HPP 2 | #define ABOUT_HPP 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class CAbout; 8 | } 9 | 10 | /*! The about dialog. */ 11 | class CAbout : public QDialog 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit CAbout (QWidget* parent = 0); 17 | ~CAbout (); 18 | 19 | protected slots : 20 | void on_m_close_clicked (); 21 | 22 | private: 23 | Ui::CAbout* ui; 24 | }; 25 | 26 | #endif // ABOUT_HPP 27 | -------------------------------------------------------------------------------- /caes256/mainwindow.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_HPP 2 | #define MAINWINDOW_HPP 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class CMainWindow; 8 | } 9 | 10 | class CMainWindow : public QMainWindow 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit CMainWindow(QWidget *parent = 0); 16 | ~CMainWindow(); 17 | 18 | protected slots : 19 | void on_m_crypt_clicked (); 20 | 21 | private: 22 | Ui::CMainWindow *ui; 23 | }; 24 | 25 | #endif // MAINWINDOW_HPP 26 | -------------------------------------------------------------------------------- /aivctrl/install/linux64/Output/debian/DEBIAN/postrm: -------------------------------------------------------------------------------- 1 | echo "Remove configuration files and playlist folders" 2 | if [ -f /usr/share/applications/aivctrl.desktop ] 3 | then 4 | sudo rm /usr/share/applications/aivctrl.desktop 5 | echo "/usr/share/applications/aivctrl.desktop has been removed" 6 | fi 7 | 8 | if [ -d /home/$SUDO_USER/.local/share/aivctrl ] 9 | then 10 | sudo rm -r /home/$SUDO_USER/.local/share/aivctrl 11 | echo "/home/$SUDO_USER/.local/share/aivctrl has been removed" 12 | fi 13 | -------------------------------------------------------------------------------- /aivctrl/install/pi32/Output/debian/DEBIAN/postrm: -------------------------------------------------------------------------------- 1 | echo "Remove configuration files and playlist folders" 2 | if [ -f /usr/share/applications/aivctrl.desktop ] 3 | then 4 | sudo rm /usr/share/applications/aivctrl.desktop 5 | echo "/usr/share/applications/aivctrl.desktop has been removed" 6 | fi 7 | 8 | if [ -d /home/$SUDO_USER/.local/share/aivctrl ] 9 | then 10 | sudo rm -r /home/$SUDO_USER/.local/share/aivctrl 11 | echo "/home/$SUDO_USER/.local/share/aivctrl has been removed" 12 | fi 13 | 14 | -------------------------------------------------------------------------------- /aivctrl/install/pi32/Output/debian/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Source: AIVCtrl 2 | Package: AIVCtrl 3 | Version: 1.1.4 4 | Section: base 5 | Priority: optional 6 | Architecture: all 7 | Maintainer: PTaravel 8 | Homepage: https://github.com/ptstream/QtUPnP 9 | Installed-Size: 60000 10 | Description: AIVCtrl control point. 11 | AIVCtrl is an UPnP/AV control point will provide methods to browse a media server's content and will perform all the necessary tasks to enable a renderer to playback the selected tracks, playlist... 12 | -------------------------------------------------------------------------------- /aivctrl/install/linux64/Output/debian/DEBIAN/control: -------------------------------------------------------------------------------- 1 | Source: AIVCtrl 2 | Package: AIVCtrl 3 | Version: 1.1.4 4 | Section: base 5 | Priority: optional 6 | Architecture: all 7 | Maintainer: PTStream 8 | Homepage: https://github.com/ptstream/QtUPnP 9 | Installed-Size: 60000 10 | Description: AIVCtrl control point. 11 | AIVCtrl is an UPnP/AV control point will provide methods to browse a media server's content and will perform all the necessary tasks to enable a renderer to playback the selected tracks, playlist... 12 | 13 | -------------------------------------------------------------------------------- /upnp/dump.cpp: -------------------------------------------------------------------------------- 1 | #include "dump.hpp" 2 | #include 3 | 4 | USING_UPNP_NAMESPACE 5 | 6 | CDump* CDump::m_dump = nullptr; 7 | 8 | CDump::CDump (QObject* parent) : QObject (parent) 9 | { 10 | m_dump = this; 11 | } 12 | 13 | void CDump::dump (QString const & text) 14 | { 15 | QTime time = QTime::currentTime (); 16 | QString t = time.toString () + ':' + text + '\n'; 17 | emit m_dump->dumpReady (t); 18 | } 19 | 20 | void CDump::dump (QByteArray const & bytes) 21 | { 22 | dump (QString::fromUtf8 (bytes)); 23 | } 24 | -------------------------------------------------------------------------------- /linux-build/QtUPnP.sh: -------------------------------------------------------------------------------- 1 | # Build and launch chupnp. 2 | # The environment variable QMAKEFOLDEER must point to the qmake folder. 3 | # e.g. For my Kubuntu Qt intallation, the folder is $HOME/Qt5.8.0/5.8/gcc_64/bin 4 | # For my Raspberry PI 3, the folder is /usr/bin 5 | 6 | # Create the qmake folder environmen variable 7 | QMAKE=$HOME/Qt5.8.0/5.8/gcc_64/bin/qmake 8 | 9 | # Create the Linux Makefile 10 | $QMAKE ../QtUPnP.pro 11 | 12 | # Build chupnp 13 | make -j 14 | 15 | # Launch chupnp 16 | chupnp/chupnp 17 | -------------------------------------------------------------------------------- /upnp/avcontrol.cpp: -------------------------------------------------------------------------------- 1 | #include "avcontrol.hpp" 2 | 3 | USING_UPNP_NAMESPACE 4 | 5 | CAVControl::CAVControl () 6 | { 7 | } 8 | 9 | CAVControl::CAVControl (CControlPoint* cp) : m_cm (cp), m_cd (cp), m_tr (cp), m_rc (cp) 10 | { 11 | } 12 | 13 | void CAVControl::setControlPoint (CControlPoint* cp) 14 | { 15 | m_cm.setControlPoint (cp); 16 | m_cd.setControlPoint (cp); 17 | m_tr.setControlPoint (cp); 18 | m_rc.setControlPoint (cp); 19 | } 20 | 21 | CControlPoint* CAVControl::controlPoint () 22 | { 23 | return m_cm.controlPoint (); 24 | } 25 | -------------------------------------------------------------------------------- /linux-build/aivctrl.sh: -------------------------------------------------------------------------------- 1 | # Build and launch aivctrl 2 | # The environment variable QMAKEFOLDEER must point to the qmake folder. 3 | # e.g. For my Kubuntu Qt intallation, the folder is $HOME/Qt5.8.0/5.8/gcc_64/bin 4 | # For my Raspberry PI 3, the folder is /usr/bin 5 | 6 | # Create the qmake folder environmen variable 7 | QMAKE=$HOME/Qt5.8.0/5.8/gcc_64/bin/qmake 8 | 9 | # Create the Linux Makefile 10 | $QMAKEFOLDER/qmake ../aivctrl.pro 11 | 12 | # Build chupnp 13 | make 14 | 15 | # Launch aivctrl 16 | aivctrl/aivctrl 17 | -------------------------------------------------------------------------------- /aivctrl/install/pi32/Output/doc.txt: -------------------------------------------------------------------------------- 1 | Create debian package: 2 | sudo chmod 755 post* 3 | sudo dpkg-deb --build debian aivctrl-1.0.1.deb 4 | 5 | Install package 6 | sudo dpkg -i aivctrl-1.0.1.deb 7 | 8 | Uninstall package 9 | sudo apt-get remove aivctrl 10 | 11 | Executable directory: /usr/bin/aivctrl 12 | Data directory: /home/$USER/.local/share/aivctrl 13 | aivctrl.desktop file: /usr/share/applications/ 14 | 15 | In case of problem : 16 | backup file /var/lib/dpkg/status 17 | edit /var/lib/dpkg/status (warning lines length) 18 | remove aivctrl block. 19 | -------------------------------------------------------------------------------- /aivctrl/install/linux64/Output/doc.txt: -------------------------------------------------------------------------------- 1 | Create debian package: 2 | sudo chmod 755 post* 3 | sudo dpkg-deb --build debian aivctrl-1.0.1.deb 4 | 5 | Install package 6 | sudo dpkg -i aivctrl-1.0.1.deb 7 | 8 | Uninstall package 9 | sudo apt-get remove aivctrl 10 | 11 | Executable directory: /usr/bin/aivctrl 12 | Data directory: /home/$USER/.local/share/aivctrl 13 | aivctrl.desktop file: /usr/share/applications/ 14 | 15 | In case of problem : 16 | backup file /var/lib/dpkg/status 17 | edit /var/lib/dpkg/status (warning lines length) 18 | remove aivctrl block. 19 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | ## LICENSE 2 | 3 | QtUPnP is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | QtUPnP is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | For details about the license see LICENSE file. 14 | -------------------------------------------------------------------------------- /aivctrl/aivwidgets/cloudbrowser.cpp: -------------------------------------------------------------------------------- 1 | #include "cloudbrowser.hpp" 2 | #include "../upnp/plugin.hpp" 3 | 4 | USING_UPNP_NAMESPACE 5 | 6 | CCloudBrowserItem::CCloudBrowserItem (QtUPnP::CPlugin const * plugin, QListWidget* parent, int type) : 7 | QListWidgetItem (parent, type), m_plugin (plugin) 8 | { 9 | setText (plugin->friendlyName ()); 10 | setIcon (plugin->pixmap ()); 11 | } 12 | 13 | CCloudBrowser::CCloudBrowser (QWidget* parent) : CListWidgetBase (parent) 14 | { 15 | } 16 | 17 | void CCloudBrowser::addItem (CPlugin const * plugin) 18 | { 19 | new CCloudBrowserItem (plugin, this); 20 | } 21 | -------------------------------------------------------------------------------- /chupnp/chupnp.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | resources/renderer.png 4 | resources/server.png 5 | resources/otherdevices.png 6 | resources/arrow.png 7 | resources/folder.png 8 | resources/image.png 9 | resources/unknown.png 10 | resources/video.png 11 | resources/audio.png 12 | resources/container.png 13 | resources/music_album.png 14 | 15 | 16 | -------------------------------------------------------------------------------- /chupnp/search.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SEARCH_HPP 2 | #define SEARCH_HPP 3 | 4 | #include "../upnp/browsereply.hpp" 5 | #include 6 | 7 | USING_UPNP_NAMESPACE 8 | 9 | namespace Ui { 10 | class CSearch; 11 | } 12 | 13 | class CSearch : public QDialog 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | explicit CSearch (QList const & items, QWidget *parent = 0); 19 | ~CSearch (); 20 | 21 | protected slots : 22 | void on_m_text_textChanged (QString const & text); 23 | 24 | private: 25 | Ui::CSearch* ui; 26 | QList m_items; 27 | }; 28 | 29 | #endif // SEARCH_HPP 30 | -------------------------------------------------------------------------------- /chupnp/helper.hpp: -------------------------------------------------------------------------------- 1 | #ifndef HELPER_HPP 2 | #define HELPER_HPP 3 | 4 | #include 5 | 6 | class QTreeWidgetItem; 7 | class QColor; 8 | class QTextStream; 9 | 10 | bool isHandled (QString const & name); 11 | void addElapsedTime (QTreeWidgetItem* item); 12 | void setGetActionItemColor (QTreeWidgetItem* item); 13 | void setItemColor (QTreeWidgetItem* item, QColor const & color); 14 | int timeMs (QTime const & time); 15 | int timeMs (QString const & time); 16 | void enumerateChildren (QTextStream& s, QTreeWidgetItem* item); 17 | void addTotalTime (QTreeWidgetItem* item, int ms); 18 | 19 | #endif // HELPER_HPP 20 | -------------------------------------------------------------------------------- /aivctrl/install/pi32/readme: -------------------------------------------------------------------------------- 1 | To create a Debian installer a shell command is provided. 2 | 3 | 1. Launch build.sh to create the ".../QtUPnP/aivctrl/install/linux64/Output/debian/usr/aivctrl" folder containing all files to run aivctrl. 4 | It contains also "aivctrl.desktop" the shortcut to launch aivctrl and "aivctrl.run.desktop" to launch aivctrl.run. 5 | aivctrl.desktop is used when all Qt dependencies are SATISFIED (e.g. Kubuntu 17.10). 6 | aivctrl.run.desktop is used when all Qt dependencies are UNSATISFIED (e.g. Ubuntu 16.04 LTS). 7 | 8 | 2. The Debian package is created ".../QtUPnP/aivctrl/install/linux64/Output". 9 | 10 | 11 | -------------------------------------------------------------------------------- /aivctrl/install/macos/deployt.sh: -------------------------------------------------------------------------------- 1 | PRODUCT=aivctrl 2 | QTDIR=/Users/$USER/Qt/5.12.3/clang_64 3 | DEVEL=/Users/$USER/Documents/Development/QtUPnP 4 | OUTPUT=$DEVEL/$PRODUCT/install/macos/Output 5 | TARGET=$OUTPUT/$PRODUCT 6 | BINARIES=/Users/$USER/Documents/Development/build-$PRODUCT-Desktop_Qt_5_12_3_clang_64bit-Release 7 | VERSION=1.1.4 8 | 9 | WD=$PWD 10 | cd $BINARIES/$PRODUCT 11 | $QTDIR/bin/macdeployqt $PRODUCT.app -dmg 12 | cd $WD 13 | if [ -f Output/aivctrl-$VERSION.dmg ] 14 | then 15 | rm Output/aivctrl-$VERSION.dmg 16 | fi 17 | mv $BINARIES/$PRODUCT/$PRODUCT.dmg Output/ 18 | mv Output/aivctrl.dmg Output/aivctrl-$VERSION.dmg 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /upnp/control.cpp: -------------------------------------------------------------------------------- 1 | #include "control.hpp" 2 | #include "actioninfo.hpp" 3 | 4 | USING_UPNP_NAMESPACE 5 | 6 | QStringList CControl::fromCVS (QString entryString) 7 | { 8 | QStringList list; 9 | if (!entryString.isEmpty ()) 10 | { 11 | list = entryString.remove (' ').split (','); 12 | } 13 | 14 | return list; 15 | } 16 | 17 | bool CControl::toBool (QString const & entryString) 18 | { 19 | bool value = false; 20 | if (!entryString.isEmpty ()) 21 | { 22 | value = entryString[0] != '0' && entryString[0] != 'f' && entryString[0] != 'F'; 23 | } 24 | 25 | return value; 26 | } 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /caes256/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.hpp" 2 | #include 3 | 4 | /*! This simple program is used to encrypt client_id and client_secret 5 | * to use with the QtUPnP plugins. They are the OAuth2 tokens. 6 | * The two encrypted values are stored in .ids file. 7 | * 8 | * All secret values are AES256 crypted with key and iv defined in ../upnp/aes256.h. 9 | * The crypt an decrypt use cryptographic hashes (sha256) of key and iv before use. 10 | * Lastly rhese two values are converted in base 64. 11 | */ 12 | int main(int argc, char *argv[]) 13 | { 14 | QApplication a(argc, argv); 15 | CMainWindow w; 16 | w.show(); 17 | 18 | return a.exec(); 19 | } 20 | -------------------------------------------------------------------------------- /aivctrl/install/linux64/readme: -------------------------------------------------------------------------------- 1 | To create a Debian installer a shell command is provided. 2 | 3 | 1. Launch build.sh to create the ".../QtUPnP/aivctrl/install/linux64/Output/debian/usr/aivctrl" folder containing all files to run aivctrl. 4 | It contains also "aivctrl.desktop" the shortcut to launch aivctrl and "aivctrl.run.desktop" to launch aivctrl.run. 5 | aivctrl.desktop is used when all Qt dependencies are SATISFIED (e.g. Kubuntu 17.10). 6 | aivctrl.run.desktop is used when all Qt dependencies are UNSATISFIED (e.g. Ubuntu 16.04 LTS). 7 | 8 | 2. The Debian package is created ".../QtUPnP/aivctrl/install/linux64/Output". Also a zip file is created to use without installer. 9 | 10 | 11 | -------------------------------------------------------------------------------- /upnp/waitingloop.cpp: -------------------------------------------------------------------------------- 1 | #include "using_upnp_namespace.hpp" 2 | #include "waitingloop.hpp" 3 | #include 4 | 5 | USING_UPNP_NAMESPACE 6 | 7 | CWaitingLoop::CWaitingLoop (int timeout, ProcessEventsFlags flags, QObject* parent) : QEventLoop (parent), m_flags (flags) 8 | { 9 | if (timeout > 0) 10 | { 11 | m_idTimer = QEventLoop::startTimer (timeout); 12 | } 13 | } 14 | 15 | void CWaitingLoop::timerEvent (QTimerEvent*) 16 | { 17 | QEventLoop::killTimer (m_idTimer); 18 | QEventLoop::quit (); 19 | } 20 | 21 | void CWaitingLoop::wait (int timeout, ProcessEventsFlags flags) 22 | { 23 | CWaitingLoop loop (timeout, flags); 24 | loop.exec (flags); 25 | } 26 | -------------------------------------------------------------------------------- /chupnp/item.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ITEM_HPP 2 | #define ITEM_HPP 3 | 4 | #include "../upnp/didlitem.hpp" 5 | #include 6 | 7 | USING_UPNP_NAMESPACE 8 | 9 | enum EItemType { NoType = QTreeWidgetItem::Type, 10 | BrowseType = QTreeWidgetItem::UserType, 11 | SearchType, 12 | ActionType, 13 | }; 14 | 15 | class CItem : public QTreeWidgetItem 16 | { 17 | public : 18 | CItem (QTreeWidgetItem* item, CDidlItem const & didl, EItemType type); 19 | 20 | CDidlItem const & didl () const { return m_didl; } 21 | CDidlItem& didl () { return m_didl; } 22 | 23 | private : 24 | CDidlItem m_didl; 25 | }; 26 | 27 | #endif // ITEM_HPP 28 | -------------------------------------------------------------------------------- /upnp/unicastsocket.hpp: -------------------------------------------------------------------------------- 1 | #ifndef UNICAST_SOCKET_HPP 2 | #define UNICAST_SOCKET_HPP 1 3 | 4 | #include "upnpsocket.hpp" 5 | 6 | START_DEFINE_UPNP_NAMESPACE 7 | 8 | /*! \brief Provides the mechanism to manage unicast sockets. */ 9 | class CUnicastSocket : public CUpnpSocket 10 | { 11 | public : 12 | /*! Default constructor. */ 13 | CUnicastSocket (QObject* parent = nullptr); 14 | 15 | /*! Destructor. */ 16 | virtual ~CUnicastSocket (); 17 | 18 | /*! Binds to IPV4 address on addr. 19 | * \param addr: The host address. 20 | * \return The port or 0 in case of failure. 21 | */ 22 | quint16 bind (QHostAddress const & addr); 23 | }; 24 | 25 | } // End namespace 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /aivctrl/aivctrl.rc: -------------------------------------------------------------------------------- 1 | 1 VERSIONINFO 2 | FILEVERSION 1,1,4,0 3 | PRODUCTVERSION 1,1,4,0 4 | BEGIN 5 | BLOCK "StringFileInfo" 6 | BEGIN 7 | BLOCK "080904E4" 8 | BEGIN 9 | VALUE "CompanyName", "" 10 | VALUE "FileDescription", "An UPnP Control Point" 11 | VALUE "FileVersion", "1,1,4,0" 12 | VALUE "InternalName", "aivctrl" 13 | VALUE "LegalCopyright", "Copyright (C) 2017-2018" 14 | VALUE "OriginalFilename", "aivctrl.exe" 15 | VALUE "ProductName", "aivctrl" 16 | VALUE "ProductVersion", "1,1,4,0" 17 | END 18 | END 19 | 20 | BLOCK "VarFileInfo" 21 | BEGIN 22 | VALUE "Translation", 0x809, 1252 23 | END 24 | END 25 | 26 | 10 ICON DISCARDABLE "icons\\aivctrl48.ico" 27 | -------------------------------------------------------------------------------- /upnp/xmlhaction.cpp: -------------------------------------------------------------------------------- 1 | #include "xmlhaction.hpp" 2 | 3 | USING_UPNP_NAMESPACE 4 | 5 | CXmlHAction::CXmlHAction (QString const & actionName, QMap& vars) : m_actionName (actionName), m_vars (vars) 6 | { 7 | } 8 | 9 | bool CXmlHAction::characters (QString const & name) 10 | { 11 | QString const & tag = m_stack.top (); 12 | if (tag == "u:errorCode") 13 | { 14 | m_errorCode = name.toInt (); 15 | 16 | } 17 | else if (tag == "u:errorDescription") 18 | { 19 | m_errorDesc = name; 20 | } 21 | else 22 | { 23 | QString pTag = tagParent (); 24 | if (pTag.endsWith (m_actionName + "Response")) 25 | { 26 | m_vars.insert (tag, name); 27 | } 28 | } 29 | 30 | return true; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /aivctrl/xmlhplaylist.hpp: -------------------------------------------------------------------------------- 1 | #ifndef XMLHPLAYLIST_HPP 2 | #define XMLHPLAYLIST_HPP 3 | 4 | #include "../upnp/xmlh.hpp" 5 | #include "../upnp/didlitem.hpp" 6 | 7 | class CPlaylist; 8 | 9 | /*! Xml handler to read a playlist at format xspf. 10 | * This handler creates from standard tag of the xspf file the CDidlItems. 11 | * If QtUPnP extensions tags exists, these are mixed with the previous. 12 | */ 13 | class CXmlHPlaylist : public QtUPnP::CXmlH 14 | { 15 | public: 16 | CXmlHPlaylist (CPlaylist& playlist); 17 | 18 | virtual bool startElement (QString const &namespaceURI, QString const & localName, QString const &, QXmlAttributes const &); 19 | virtual bool characters (QString const & name); 20 | 21 | private : 22 | CPlaylist& m_playlist; 23 | QString m_name; 24 | }; 25 | 26 | #endif // XMLHPLAYLIST_HPP 27 | -------------------------------------------------------------------------------- /upnp/unicastsocket.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "unicastsocket.hpp" 3 | #include "helper.hpp" 4 | 5 | USING_UPNP_NAMESPACE 6 | 7 | CUnicastSocket::CUnicastSocket (QObject* parent) : CUpnpSocket (parent) 8 | { 9 | } 10 | 11 | CUnicastSocket::~CUnicastSocket () 12 | { 13 | } 14 | 15 | quint16 CUnicastSocket::bind (QHostAddress const & addr) 16 | { 17 | quint16 port; 18 | // The range is specified by the UDA 1.1 standard 19 | for (port = 49152; port < 65535; ++port) 20 | { 21 | if (QUdpSocket::bind (addr, port, QAbstractSocket::DontShareAddress)) 22 | { 23 | break; 24 | } 25 | } 26 | 27 | if (port == 65535 || state () != QUdpSocket::BoundState) 28 | { 29 | qDebug () << "CUnicastSocket::bind (no ports free):" << addr.toString ().toLatin1 () + ':'+ QByteArray::number (port); 30 | port = 0; 31 | } 32 | 33 | return port; 34 | } 35 | -------------------------------------------------------------------------------- /linux-build/doc.txt: -------------------------------------------------------------------------------- 1 | This folder contains some bash files to build chupnp and aivctrl on linux machines without using QtCreator. 2 | The bash files: 3 | - Create the file Makefile form qmake utility. 4 | - Build chupnp and/or aivctrl with make linux command 5 | - Launch chupnp or aivctrl. 6 | 7 | Please see the comments in these bash files to set the environment variable for qmake utility. 8 | 9 | aivctrl.sh builds only the English version and use Qt libraries files installed on the computer. 10 | To run a full version without Qt intallation, you can take inspiration from the file QtUPnP/aivctrl/install/linux64/build.sh. 11 | This bash file creates a folder with all necessary files and folders. It creates also a Debian package and a zip file. 12 | 13 | Launch these bash files in this folder or in any folder that is not the parent of linux-build. 14 | 15 | Many thank's to Przemo Firszt for the Fedora build scripts. 16 | 17 | -------------------------------------------------------------------------------- /aivctrl/aivwidgets/listwidgetbase.cpp: -------------------------------------------------------------------------------- 1 | #include "listwidgetbase.hpp" 2 | #include "widgethelper.hpp" 3 | 4 | CListWidgetBase::CListWidgetBase (QWidget* parent) : QListWidget (parent) 5 | { 6 | setTransparentBackGround (this); 7 | #ifdef Q_OS_LINUX 8 | setItemMouseOverColor(this); 9 | #endif 10 | connect (this, &CListWidgetBase::itemClicked, this, &CListWidgetBase::saveSelected); 11 | connect (this, &CListWidgetBase::itemDoubleClicked, this, &CListWidgetBase::saveSelected); 12 | } 13 | 14 | void CListWidgetBase::saveSelected (QListWidgetItem* item) 15 | { 16 | m_selectedRow = row (item); 17 | } 18 | 19 | int CListWidgetBase::boldIndex () const 20 | { 21 | int index = -1; 22 | for (int iItem = 0, end = count (); iItem < end; ++iItem) 23 | { 24 | QListWidgetItem* item = this->item (iItem); 25 | QFont font = item->font (); 26 | if (font.bold ()) 27 | { 28 | index = iItem; 29 | break; 30 | } 31 | } 32 | 33 | return index; 34 | } 35 | -------------------------------------------------------------------------------- /aivctrl/playlistchoice.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PLAYLISTCHOICE_HPP 2 | #define PLAYLISTCHOICE_HPP 3 | 4 | #include "playlist.hpp" 5 | #include 6 | 7 | namespace Ui { 8 | class CPlaylistChoice; 9 | } 10 | 11 | class QListWidgetItem; 12 | 13 | /*! Dialog box to choose an existing playlist or create a new playlist. */ 14 | class CPlaylistChoice : public QDialog 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | explicit CPlaylistChoice (QMap const & playlists, QString const & title, CPlaylist::EType type, 20 | int cItems, QWidget* parent = nullptr); 21 | ~CPlaylistChoice (); 22 | 23 | QString name () const; 24 | 25 | protected slots : 26 | void on_m_names_itemClicked (QListWidgetItem* item); 27 | void on_m_names_itemDoubleClicked (QListWidgetItem* item); 28 | void on_m_ok_clicked (); 29 | void on_m_cancel_clicked (); 30 | 31 | private: 32 | Ui::CPlaylistChoice* ui; 33 | QMap const & m_playlists; 34 | }; 35 | 36 | #endif // PLAYLISTCHOICE_HPP 37 | -------------------------------------------------------------------------------- /chupnp/search.cpp: -------------------------------------------------------------------------------- 1 | #include "search.hpp" 2 | #include "ui_search.h" 3 | 4 | CSearch::CSearch (QList const & items, QWidget *parent) : QDialog (parent), 5 | ui (new Ui::CSearch), m_items (items) 6 | { 7 | ui->setupUi (this); 8 | for (CDidlItem const & item : items) 9 | { 10 | QString const & title = item.title (); 11 | ui->m_items->addItem (title); 12 | } 13 | } 14 | 15 | CSearch::~CSearch () 16 | { 17 | delete ui; 18 | } 19 | 20 | void CSearch::on_m_text_textChanged (QString const & text) 21 | { 22 | QList sortedItems; 23 | ui->m_items->clear (); 24 | if (text.isEmpty ()) 25 | { 26 | sortedItems = m_items; 27 | } 28 | else 29 | { 30 | sortedItems = CBrowseReply::search (m_items, text, 30); 31 | } 32 | 33 | for (CDidlItem const & item : sortedItems) 34 | { 35 | QString const & title = item.title (); 36 | ui->m_items->addItem (title); 37 | } 38 | 39 | ui->m_items->scrollToTop (); 40 | } 41 | -------------------------------------------------------------------------------- /aivctrl/language.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LANGUAGE_HPP 2 | #define LANGUAGE_HPP 3 | 4 | #include 5 | 6 | class QListWidgetItem; 7 | class QAbstractButton; 8 | 9 | namespace Ui { 10 | class CLanguage; 11 | } 12 | 13 | /*! This dialog provides functionalities to change the current language. */ 14 | class CLanguage : public QDialog 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | enum EType { tyLongName, tyShortName, tyQmFile }; 20 | typedef std::array TLanguage; 21 | 22 | explicit CLanguage (QWidget* parent = nullptr); 23 | ~CLanguage (); 24 | 25 | QString qmFileSelected () const; 26 | QString shortNameSelected () const; 27 | 28 | protected slots : 29 | void on_m_languages_itemDoubleClicked (QListWidgetItem* item); 30 | void on_m_languages_itemSelectionChanged (); 31 | void on_m_ok_clicked (); 32 | void on_m_cancel_clicked (); 33 | 34 | private: 35 | Ui::CLanguage* ui; 36 | QList m_availableLanguages; 37 | int m_slectedLanguageIndex = -1; 38 | }; 39 | 40 | #endif // LANGUAGE_HPP 41 | -------------------------------------------------------------------------------- /aivctrl/aivwidgets/slider.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SLIDER_HPP 2 | #define SLIDER_HPP 3 | 4 | #include 5 | 6 | /*! \brief This class changes the page up and page down QSlider mechanism. 7 | * 8 | * When page up or page down is clicked, the value goes to the position of the cursor. By default 9 | * the value is incremented or decremented by pageStep. 10 | */ 11 | class CSlider : public QSlider 12 | { 13 | public: 14 | /*! Default constructor. */ 15 | CSlider (QWidget* parent = nullptr); 16 | 17 | /*! Sets the QSlider value at the cursor position. */ 18 | void jumpToMousePosition (int action); 19 | 20 | /*! Returns the flag m_mousePressed. */ 21 | bool mousePressed () const { return m_mousePressed; } 22 | 23 | protected : 24 | /*! Sets the flag m_mousePressed at true. */ 25 | virtual void mousePressEvent (QMouseEvent* event); 26 | 27 | /*! Sets the flag m_mousePressed at false. */ 28 | virtual void mouseReleaseEvent (QMouseEvent* event); 29 | 30 | protected : 31 | bool m_mousePressed = false; //!< Flag m_mousePressed. 32 | }; 33 | 34 | #endif // SLIDER_HPP 35 | -------------------------------------------------------------------------------- /aivctrl/settings.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SETTINGS_HPP 2 | #define SETTINGS_HPP 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class CSettings; 8 | } 9 | 10 | class CSettings : public QDialog 11 | { 12 | Q_OBJECT 13 | public: 14 | enum EIndex { ShowNetworkCom, 15 | UseSearchForCheckPlaylist, 16 | UPnPEventsOnly, 17 | DontUsePlaylists, 18 | ShowCloudServers, 19 | LastIndex, 20 | }; 21 | 22 | explicit CSettings (bool* flags, QSize& iconSize, QWidget* parent = nullptr); 23 | ~CSettings (); 24 | 25 | bool resetState () const { return m_reset; } 26 | 27 | static void setIconSize (QWidget* w, QSize const & size); 28 | 29 | private slots : 30 | void on_m_reset_clicked (); 31 | void on_m_ok_clicked (); 32 | void on_m_cancel_clicked (); 33 | void on_m_iconSize_valueChanged (int value); 34 | 35 | private: 36 | Ui::CSettings* ui; 37 | bool* m_flags; 38 | QSize& m_iconSize; 39 | QSize m_iconSizeBackup; 40 | bool m_reset = false; 41 | }; 42 | 43 | #endif // SETTINGS_HPP 44 | -------------------------------------------------------------------------------- /aivctrl/aivwidgets/cloudbrowser.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CLOUDBROWSER_HPP 2 | #define CLOUDBROWSER_HPP 3 | 4 | #include "listwidgetbase.hpp" 5 | 6 | namespace QtUPnP 7 | { 8 | class CPlugin; 9 | } 10 | 11 | class CCloudBrowserItem : public QListWidgetItem 12 | { 13 | public : 14 | /*! Default constructor. */ 15 | CCloudBrowserItem (QListWidget* parent = nullptr, int type = Type); 16 | 17 | /*! Constructor with device and default icons. */ 18 | CCloudBrowserItem (QtUPnP::CPlugin const * plugin, QListWidget* parent = nullptr, int type = Type); 19 | 20 | /*! Copy constructor. */ 21 | CCloudBrowserItem (CCloudBrowserItem const & other); 22 | 23 | /*! Update the tooltip. */ 24 | void updateTooltip (); 25 | 26 | QtUPnP::CPlugin const * plugin () const { return m_plugin; } 27 | 28 | private : 29 | QtUPnP::CPlugin const * m_plugin; 30 | }; 31 | 32 | class CCloudBrowser : public CListWidgetBase 33 | { 34 | Q_OBJECT 35 | 36 | public: 37 | CCloudBrowser (QWidget* parent = nullptr); 38 | 39 | /*! Adds a device to the list widget. */ 40 | void addItem (QtUPnP::CPlugin const * plugin); 41 | }; 42 | 43 | #endif // CLOUDBROWSER_HPP 44 | -------------------------------------------------------------------------------- /aivctrl/helper.hpp: -------------------------------------------------------------------------------- 1 | #ifndef HELPER_HPP 2 | #define HELPER_HPP 3 | 4 | #include 5 | class QTranslator; 6 | 7 | /*! The uniq AIVCtrl identifier. */ 8 | #define APPURN "urn:aivctrl:16f0fcf7-a61a-49b9-888e-446322f61113" 9 | 10 | /*! Returns the system temp directory. */ 11 | QString tempDirectory (); 12 | 13 | /*! Returns the application data directory. */ 14 | QString appDataDirectory (); 15 | 16 | /*! Return "aivctrl". */ 17 | QString appBaseName (); 18 | 19 | /*! Return application file path. For example for Windows, C:\Program Files (x86)\aivctrl. */ 20 | QString appFilePath (); 21 | 22 | /*! Return application file path. For example for Windows, C:\Program Files (x86). */ 23 | QString appFileDir (); 24 | 25 | /*! Returns error file path. */ 26 | QString errorFilePath (); 27 | 28 | /*! Returns the error file path. For Windows, "C:\Users\%USERNAME%\AppData\Local\Temp\-dump-errors.txt". */ 29 | void dumpError (QString const & text); 30 | 31 | /*! Removes the error file . */ 32 | void removeDumpError (); 33 | 34 | /*! Installs a new translator. */ 35 | QTranslator* installTranslator (QString& locale); 36 | 37 | #endif // HELPER_HPP 38 | -------------------------------------------------------------------------------- /upnp/waitingloop.hpp: -------------------------------------------------------------------------------- 1 | #ifndef WAITING_LOOP_HPP 2 | #define WAITING_LOOP_HPP 3 | 4 | #include "using_upnp_namespace.hpp" 5 | #include "upnp_global.hpp" 6 | #include 7 | 8 | START_DEFINE_UPNP_NAMESPACE 9 | 10 | /*! \brief Defines a waiting loop to stop the current thread without 11 | * freeze the UI during certain operations. 12 | */ 13 | class UPNP_API CWaitingLoop : public QEventLoop 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | /*! Contructs CWaitingLoop with a delay of timeout. */ 19 | CWaitingLoop (int timeout, ProcessEventsFlags flags, QObject* parent = nullptr); 20 | 21 | /*! Starts the loop with a delay of timeout. */ 22 | void start (int timeout) { m_idTimer = QEventLoop::startTimer (timeout); } 23 | 24 | /*! Creates and starts a waiting loop. */ 25 | static void wait (int timeout, ProcessEventsFlags flags); 26 | 27 | protected: 28 | /*! Event generate by the timer. */ 29 | virtual void timerEvent (QTimerEvent*); 30 | 31 | private : 32 | ProcessEventsFlags m_flags = QEventLoop::AllEvents; 33 | int m_idTimer = 0; //!< Qt timer identifier. */ 34 | }; 35 | 36 | } // End namespace 37 | 38 | #endif // WAITING_LOOP_HPP 39 | -------------------------------------------------------------------------------- /aivctrl/aivwidgets/textmetadata.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TEXTMETADATA_HPP 2 | #define TEXTMETADATA_HPP 3 | 4 | #include 5 | 6 | /*! \brief This class provides functionalities to show a paragraphe from a QStringList. 7 | * 8 | * One line for QStringList QString. A html text is sent at the QTextEdit. 9 | */ 10 | class CTextMetaData : public QTextEdit 11 | { 12 | Q_OBJECT 13 | public: 14 | /*! Default constructor. */ 15 | CTextMetaData (QWidget* parent = nullptr); 16 | 17 | /*! Sets the texts. */ 18 | void setText (QStringList const & texts); 19 | 20 | /*! Truncates texts.The texts are truncated at the widget size. */ 21 | QString truncateText (QString const & text); 22 | 23 | /*! Clears all texts. */ 24 | void clear (); 25 | 26 | /*! Truncates texts.The texts are truncated at the widget size. */ 27 | static QString truncateText (QString const & text, QWidget* widget); 28 | 29 | protected : 30 | /*! Retruncates texts at the new size */ 31 | virtual void resizeEvent (QResizeEvent* event); 32 | 33 | /*! Updates the QTextEdit. */ 34 | void updateText (); 35 | 36 | protected : 37 | QStringList m_texts; //!< The texts. One for each line. 38 | }; 39 | 40 | #endif // TEXTMETADATA_HPP 41 | -------------------------------------------------------------------------------- /chupnp/stdaction.hpp: -------------------------------------------------------------------------------- 1 | #ifndef STDACTION_HPP 2 | #define STDACTION_HPP 3 | 4 | #include "../upnp/controlpoint.hpp" 5 | #include 6 | 7 | namespace Ui 8 | { 9 | class CStdAction; 10 | } 11 | 12 | namespace QtUPnP 13 | { 14 | class CControlPoint; 15 | } 16 | 17 | class QGridLayout; 18 | 19 | USING_UPNP_NAMESPACE 20 | 21 | /*! \brief The dialog to enter in parameters, launch an action and display out parameters. */ 22 | class CStdAction : public QDialog 23 | { 24 | Q_OBJECT 25 | 26 | public: 27 | explicit CStdAction (CControlPoint* cp, QString const & deviceUUID, 28 | QString const & action, QWidget* parent = nullptr); 29 | ~CStdAction (); 30 | 31 | protected slots : 32 | void on_m_invoke_clicked (); 33 | void on_m_close_clicked (); 34 | 35 | private : 36 | void createWidgets (QString const & actionName); 37 | 38 | private: 39 | Ui::CStdAction* ui = nullptr; 40 | QGridLayout* m_inLayout = nullptr, * m_outLayout = nullptr; 41 | CControlPoint* m_cp = nullptr; 42 | QString m_deviceUUID; 43 | QString m_serviceID; 44 | QString m_actionName; 45 | QList m_args; 46 | }; 47 | 48 | #endif // STDACTION_HPP 49 | -------------------------------------------------------------------------------- /upnp/action.cpp: -------------------------------------------------------------------------------- 1 | #include "action.hpp" 2 | 3 | START_DEFINE_UPNP_NAMESPACE 4 | 5 | /*! \brief Internal structure of CAction. */ 6 | struct SActionData : public QSharedData 7 | { 8 | SActionData () {} 9 | SActionData (SActionData const & other); 10 | 11 | TMArguments m_arguments; //!< Map of arguments. 12 | }; 13 | 14 | SActionData::SActionData (SActionData const & other) : QSharedData (other), m_arguments (other.m_arguments) 15 | { 16 | } 17 | 18 | } // Namespace 19 | 20 | USING_UPNP_NAMESPACE 21 | 22 | CAction::CAction () : m_d (new SActionData) 23 | { 24 | } 25 | 26 | CAction::CAction (CAction const & rhs) : m_d (rhs.m_d) 27 | { 28 | } 29 | 30 | CAction &CAction::operator = (CAction const & other) 31 | { 32 | if (this != &other) 33 | { 34 | m_d.operator = (other.m_d); 35 | } 36 | 37 | return *this; 38 | } 39 | 40 | CAction::~CAction () 41 | { 42 | } 43 | 44 | void CAction::setArguments (TMArguments const & args) 45 | { 46 | m_d->m_arguments = args; 47 | } 48 | 49 | TMArguments const & CAction::arguments () const 50 | { 51 | return m_d->m_arguments; 52 | } 53 | 54 | TMArguments& CAction::arguments() 55 | { 56 | return m_d->m_arguments; 57 | } 58 | -------------------------------------------------------------------------------- /aivctrl/aivwidgets/listwidgetbase.hpp: -------------------------------------------------------------------------------- 1 | #ifndef LISTWIDGETBASE_HPP 2 | #define LISTWIDGETBASE_HPP 3 | 4 | #include 5 | 6 | /*! \brief CListWidgetBase is the base class of CContentDirectoryBrowser. */ 7 | class CListWidgetBase : public QListWidget 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | /* Default constructor. */ 13 | CListWidgetBase (QWidget* parent = nullptr); 14 | 15 | /*! Sets the default icons. */ 16 | void setDefaultIcons (QStringList const & files) { m_defaultIcons = files; } 17 | 18 | /*! Returns the default icons. */ 19 | QStringList const & defaultIcons () const { return m_defaultIcons; } 20 | 21 | /*! Set the last selected item row. */ 22 | void setSelectedRow (int row) { m_selectedRow = row; } 23 | 24 | /*! Returns the last selected item row. */ 25 | int selectedRow () const { return m_selectedRow; } 26 | 27 | /*! Returns the last bolded item. */ 28 | int boldIndex () const; 29 | 30 | protected slots : 31 | /*! Saves the row of the selected item. */ 32 | void saveSelected (QListWidgetItem* item); 33 | 34 | protected : 35 | QStringList m_defaultIcons; //!< Default icons. 36 | int m_selectedRow = -1; //!< The last selected row. 37 | }; 38 | 39 | #endif // LISTWIDGETBASE_HPP 40 | -------------------------------------------------------------------------------- /upnp/multicastsocket.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MULTICAST_SOCKET_HPP 2 | #define MULTICAST_SOCKET_HPP 1 3 | 4 | #include "upnpsocket.hpp" 5 | 6 | START_DEFINE_UPNP_NAMESPACE 7 | 8 | /*! \brief Provides the mechanism to manage multicast sockets. */ 9 | class CMulticastSocket : public CUpnpSocket 10 | { 11 | public : 12 | /*! Default constructor. */ 13 | CMulticastSocket (QObject* parent = nullptr); 14 | 15 | /*! Destructor. */ 16 | virtual ~CMulticastSocket (); 17 | 18 | /*! Binds to IPV4 address on port multicastPort and join the multicast group. 19 | * \param bindAddr: Generally QHostAddress::AnyIPv4 ou QHostAddress::AnyIPv6. 20 | * \param group: Generally 239.255.255.250 or FF02::C. 21 | * \return True in case of success. 22 | */ 23 | bool initialize (QHostAddress const & bindAddr, QHostAddress const & group); 24 | 25 | static QHostAddress const upnpMulticastAddr; //!< Standard multicast IPV4 address. 26 | static QHostAddress const upnpMulticastAddr6; //!< Standard multicast IPV4 address. 27 | static quint16 const upnpMulticastPort; //!< Standard multicats port. 28 | 29 | private : 30 | QHostAddress m_group; //!< Save the join group. 31 | }; 32 | 33 | } // End namespace 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /upnp/initialdiscovery.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "initialdiscovery.hpp" 3 | #include "upnpsocket.hpp" 4 | #include "waitingloop.hpp" 5 | #include 6 | 7 | USING_UPNP_NAMESPACE 8 | 9 | CInitialDiscovery::CInitialDiscovery (CUpnpSocket* socket, QHostAddress const & hostAddress, quint16 port) : 10 | m_socket (socket), m_hostAddress (hostAddress), m_port (port), m_mx (2), 11 | m_idTimer (0) 12 | { 13 | } 14 | 15 | bool CInitialDiscovery::discover (bool changeMX, char const * uuid) 16 | { 17 | bool success = false; 18 | if (m_socket != nullptr) 19 | { 20 | success = m_socket->discover (m_hostAddress, m_port, m_mx, uuid); 21 | if (success && m_discoveryPause != 0) 22 | { 23 | if (success) 24 | { 25 | CWaitingLoop::wait (m_discoveryPause, QEventLoop::AllEvents); 26 | } 27 | 28 | if (changeMX) 29 | { 30 | m_mx = std::rand () % 5 + 1; // Delay [1 5] See UPnP documentation. 31 | } 32 | } 33 | } 34 | 35 | return success; 36 | } 37 | 38 | void CInitialDiscovery::timerEvent (QTimerEvent* event) 39 | { 40 | if (event->timerId () == m_idTimer) 41 | { 42 | quit (); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /chupnp/chupnp.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2017-06-23T09:07:37 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui network xml 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = chupnp 12 | TEMPLATE = app 13 | CONFIG += c++11 14 | 15 | SOURCES += main.cpp\ 16 | mainwindow.cpp \ 17 | helper.cpp \ 18 | sendgetaction.cpp \ 19 | loadservices.cpp \ 20 | slots.cpp \ 21 | item.cpp \ 22 | actionParams.cpp \ 23 | stdaction.cpp \ 24 | actiontriggered.cpp \ 25 | search.cpp 26 | 27 | HEADERS += mainwindow.hpp \ 28 | helper.hpp \ 29 | item.hpp \ 30 | actionParams.hpp \ 31 | stdaction.hpp \ 32 | search.hpp 33 | 34 | FORMS += mainwindow.ui \ 35 | actionParams.ui \ 36 | stdaction.ui \ 37 | search.ui 38 | 39 | win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../upnp/release/ -lqtupnp 40 | else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../upnp/debug/ -lqtupnp 41 | 42 | unix { 43 | LIBS += $$OUT_PWD/../upnp/libqtupnp.a 44 | PRE_TARGETDEPS += $$OUT_PWD/../upnp/libqtupnp.a 45 | } 46 | 47 | RESOURCES += \ 48 | chupnp.qrc 49 | -------------------------------------------------------------------------------- /upnp/xmlhaction.hpp: -------------------------------------------------------------------------------- 1 | #ifndef XMLH_ACTION_HPP 2 | #define XMLH_ACTION_HPP 3 | 4 | #include "xmlh.hpp" 5 | #include "statevariable.hpp" 6 | 7 | START_DEFINE_UPNP_NAMESPACE 8 | 9 | /*! \brief Provides the implementation of the action response parser. */ 10 | class CXmlHAction : public CXmlH 11 | { 12 | public: 13 | /*! Default constructor. */ 14 | CXmlHAction (QString const & actionName, QMap& vars); 15 | 16 | /*! The parser calls this function when it has parsed a chunk of character data 17 | * See QXmlContentHandler documentation. 18 | */ 19 | virtual bool characters (QString const & name); 20 | 21 | /*! Returns the error code generates by the device in case of error. */ 22 | int errorCode () const { return m_errorCode; } 23 | 24 | /*! Returns the error description generates by the device in case of error. */ 25 | QString const & errorDesc () const { return m_errorDesc; } 26 | 27 | private : 28 | QString m_actionName; //!< The name of the action. 29 | QMap& m_vars; //!< The map of arguments. 30 | int m_errorCode = 0; //!< The error code sent by the device. 31 | QString m_errorDesc; //!< The error description sent by the device. 32 | }; 33 | 34 | } // Namespace 35 | 36 | #endif // XMLH_ACTION_HPP 37 | -------------------------------------------------------------------------------- /aivctrl/aivwidgets/position.hpp: -------------------------------------------------------------------------------- 1 | #ifndef POSITION_HPP 2 | #define POSITION_HPP 3 | 4 | #include "../upnp/positioninfo.hpp" 5 | #include "slider.hpp" 6 | 7 | namespace QtUPnP 8 | { 9 | class CControlPoint; 10 | } 11 | 12 | /*! This class manages a CSlider derived of QSlider with the content of QtUPnP::CPositionInfo. 13 | * The QtUPnP::CPositionInfo::relTime () and QtUPnP::CPositionInfo::absTime () function are 14 | * used to set the value and the maximum of the slider. 15 | */ 16 | 17 | class CPosition : public CSlider 18 | { 19 | Q_OBJECT 20 | public: 21 | /*! Default construvtor. */ 22 | CPosition (QWidget* parent = nullptr); 23 | 24 | /*! Updates the position for a renderer. This function invokes GetPosition action. */ 25 | void updatePosition (QtUPnP::CControlPoint* cp, QString const & renderer); 26 | 27 | /*! Returns the current QtUPnP::CPositionInfo. */ 28 | QtUPnP::CPositionInfo const & positionInfo () const { return m_positionInfo; } 29 | 30 | /*! Returns the maximum possible absTime. */ 31 | int maxAbsTime () const { return m_maxAbsTime; } 32 | 33 | private : 34 | QtUPnP::CPositionInfo m_positionInfo; //!< The current QtUPnP::CPositionInfo. 35 | int const m_maxAbsTime = 356400000; //!< The maximum posible absTime (99h in ms). Used to detect error. 36 | }; 37 | 38 | #endif // POSITION_HPP 39 | -------------------------------------------------------------------------------- /caes256/caes256.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2018-01-28T13:28:06 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = caes256 12 | TEMPLATE = app 13 | 14 | # The following define makes your compiler emit warnings if you use 15 | # any feature of Qt which as been marked as deprecated (the exact warnings 16 | # depend on your compiler). Please consult the documentation of the 17 | # deprecated API in order to know how to port your code away from it. 18 | DEFINES += QT_DEPRECATED_WARNINGS 19 | 20 | # You can also make your code fail to compile if you use deprecated APIs. 21 | # In order to do so, uncomment the following line. 22 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 23 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 24 | 25 | 26 | SOURCES += main.cpp\ 27 | mainwindow.cpp \ 28 | ../upnp/aesencryption.cpp 29 | 30 | HEADERS += mainwindow.hpp \ 31 | ../upnp/aesencryption.h \ 32 | ../upnp/aes256.h 33 | 34 | FORMS += mainwindow.ui 35 | 36 | USEHIDDENFILE=$$(HIDDENFILES) 37 | equals(USEHIDDENFILE,"1") { 38 | DEFINES += HIDDENFILES=1 39 | } 40 | -------------------------------------------------------------------------------- /upnp/xmlhevent.hpp: -------------------------------------------------------------------------------- 1 | #ifndef XMLH_EVENT_HPP 2 | #define XMLH_EVENT_HPP 3 | 4 | #include "xmlh.hpp" 5 | #include "httpserver.hpp" 6 | 7 | START_DEFINE_UPNP_NAMESPACE 8 | 9 | /*! \brief Provides the implementation of the event parser. */ 10 | class CXmlHEvent : public CXmlH 11 | { 12 | public: 13 | /*! Default constructor. */ 14 | CXmlHEvent (TMEventVars& vars); 15 | 16 | /*! The reader calls this function when it has parsed a start element tag. 17 | * See QXmlContentHandler documentation. 18 | */ 19 | virtual bool startElement (QString const & namespaceURI, QString const & localName, QString const & qName, QXmlAttributes const & atts); 20 | 21 | /*! The parser calls this function when it has parsed a chunk of character data 22 | * See QXmlContentHandler documentation. 23 | */ 24 | virtual bool characters (QString const & name); 25 | 26 | /*! The xml handler handler e:property tag (check=true) or just LastChange evented variable (check=false). 27 | * \internal 28 | */ 29 | void setCheckProperty (bool check) { m_checkProperty = check; } 30 | 31 | private : 32 | bool m_checkProperty = true; //!< true=handle e:property tag, false=handle LastChange evented variable. 33 | TMEventVars& m_vars; //!< The last modified ariable. 34 | }; 35 | 36 | } // Namespace 37 | 38 | #endif // XMLH_EVENT_HPP 39 | -------------------------------------------------------------------------------- /aivctrl/aivwidgets/cover.hpp: -------------------------------------------------------------------------------- 1 | #ifndef COVER_HPP 2 | #define COVER_HPP 3 | 4 | #include 5 | 6 | /*! \brief The CCover class is a simple image manager. 7 | * The main functionalities are to show the cover and scale the image at the size of the container. 8 | * In this case a Qlabel. The cover can be provided by the server or the cache. 9 | */ 10 | class CCover : public QLabel 11 | { 12 | public: 13 | /*! Default constructor. */ 14 | CCover (QWidget* parent = nullptr); 15 | 16 | /*! Sets an image from an uri. */ 17 | void setImage (QString const & uri); 18 | 19 | /*! Returns the actual pixmap. */ 20 | QPixmap image () const { return m_pixmap; } 21 | 22 | /*! Sets the default image. */ 23 | void setDefaultPixmapName (QString const & name) { m_defaultPixmap = name; } 24 | 25 | /*! Returns the default image. */ 26 | QString const & defaultPixmapName () const { return m_defaultPixmap; } 27 | 28 | protected : 29 | /*! The image must be repainted. The dimensions are ajusted and if the QLabel 30 | * is disabled, a transparency coefficient is applied. 31 | */ 32 | void paintEvent (QPaintEvent* event); 33 | 34 | protected : 35 | int m_imageTimeout = 10000; //!< Timeout to obtain the image from the server. 36 | QPixmap m_pixmap; //!< The actual pixmap. 37 | QString m_defaultPixmap; //!< The default image 38 | }; 39 | 40 | 41 | #endif // COVER_HPP 42 | -------------------------------------------------------------------------------- /upnp/dump.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DUMP_HPP 2 | #define DUMP_HPP 3 | 4 | #include "using_upnp_namespace.hpp" 5 | #include "upnp_global.hpp" 6 | #include 7 | 8 | START_DEFINE_UPNP_NAMESPACE 9 | 10 | /*! \brief The CDump class provides just a signal with text data. 11 | * This class can be used to dump text information to a text widget (e.g. QTextEdit). 12 | * For this, just connect dumpReady signal to the user defined slot. 13 | * \code 14 | * QPlainTextEdit* debugInfo = new QPlainTextEdit (this); 15 | * connect (CDump::dumpObject (), SIGNAL(dumpReady(QString const &)), debugInfo, SLOT(insertPlainText(QString const &))); 16 | * \endcode 17 | */ 18 | class UPNP_API CDump : public QObject 19 | { 20 | Q_OBJECT 21 | public: 22 | /*! Contructor. */ 23 | explicit CDump (QObject* parent = 0); 24 | 25 | /*! Returns the unique dump object. */ 26 | static CDump* dumpObject () { return m_dump; } 27 | 28 | /*! Emits the signal from the unique object. 29 | * \param text: Data to emit. 30 | */ 31 | static void dump (QString const & text); 32 | 33 | /*! Emits the signal from the unique object. 34 | * \param bytes: Data to emit. 35 | */ 36 | static void dump (QByteArray const & bytes); 37 | 38 | signals: 39 | /*! The signal. */ 40 | void dumpReady (QString const & text); 41 | 42 | private : 43 | static CDump* m_dump; //!< The unique object. 44 | }; 45 | 46 | } // Namespace 47 | 48 | #endif // DUMP_HPP 49 | -------------------------------------------------------------------------------- /upnp/action.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ACTION_HPP 2 | #define ACTION_HPP 3 | 4 | #include "argument.hpp" 5 | #include 6 | #include 7 | 8 | START_DEFINE_UPNP_NAMESPACE 9 | 10 | /*! The arguments map. 11 | * \param QString: Argument name. 12 | * \param CArgument: The argument. 13 | */ 14 | typedef QMap TMArguments; 15 | 16 | /*! Forward CAction data. */ 17 | struct SActionData; 18 | 19 | /*! \brief The CAction class holds information about an UPnP action. 20 | * 21 | * It contains the map of arguments. 22 | * 23 | * \remark Use implicit Sharing QT technology. 24 | */ 25 | class UPNP_API CAction 26 | { 27 | public: 28 | /*! Default constructor. */ 29 | CAction (); 30 | 31 | /*! Copy constructor. */ 32 | CAction (CAction const & rhs); 33 | 34 | /*! Equal operator. */ 35 | CAction & operator = (CAction const & other); 36 | 37 | /*! Destructor. */ 38 | ~CAction (); 39 | 40 | /*! Sets the argument map. */ 41 | void setArguments (TMArguments const & args); 42 | 43 | /*! Return the arguments map as a constant reference. */ 44 | TMArguments const & arguments () const; 45 | 46 | /*! Return the arguments map as a constant reference. */ 47 | TMArguments& arguments (); 48 | 49 | private: 50 | QSharedDataPointer m_d; //!< Shared data pointer. 51 | }; 52 | 53 | } // Namespace 54 | 55 | #endif // ACTION_HPP 56 | -------------------------------------------------------------------------------- /upnp/xmlhevent.cpp: -------------------------------------------------------------------------------- 1 | #include "xmlhevent.hpp" 2 | 3 | USING_UPNP_NAMESPACE 4 | 5 | CXmlHEvent::CXmlHEvent (TMEventVars& vars) : m_vars (vars) 6 | { 7 | } 8 | 9 | bool CXmlHEvent::startElement (QString const & namespaceURI, QString const & localName, QString const & qName, QXmlAttributes const & atts) 10 | { 11 | CXmlH::startElement (namespaceURI, localName, qName, atts); 12 | QString tagParent = this->tagParent (); 13 | if (!m_checkProperty || tagParent == "e:property") 14 | { 15 | TEventValue val; 16 | for (int iAtt = 0, cAtts = atts.count (); iAtt < cAtts; ++iAtt) 17 | { 18 | QString name = atts.qName (iAtt); 19 | QString value = atts.value (iAtt); 20 | if (name == "val") 21 | { 22 | val.first = value; 23 | } 24 | else 25 | { 26 | val.second.push_back (TEventCst (name, value)); 27 | } 28 | } 29 | 30 | if (qName == "Event") 31 | { 32 | val.first = namespaceURI; 33 | } 34 | 35 | QString name = removeNameSpace (qName); 36 | m_vars.insertMulti (name, val); 37 | } 38 | 39 | return true; 40 | } 41 | 42 | bool CXmlHEvent::characters (QString const & name) 43 | { 44 | QString tag = m_stack.top (); 45 | if (tagParent () == "e:property") 46 | { 47 | TEventValue value; 48 | value.first = name; 49 | m_vars[removeNameSpace (tag)] = value; 50 | } 51 | 52 | return true; 53 | } 54 | -------------------------------------------------------------------------------- /caes256/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.hpp" 2 | #include "ui_mainwindow.h" 3 | #include "../upnp/aesencryption.h" 4 | #include 5 | 6 | CMainWindow::CMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::CMainWindow) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | CMainWindow::~CMainWindow() 12 | { 13 | delete ui; 14 | } 15 | 16 | void CMainWindow::on_m_crypt_clicked () 17 | { 18 | QByteArray crypted, uncrypted; 19 | QLineEdit* les[] = { ui->m_u1, ui->m_u2 }; 20 | QLabel* las[] = { ui->m_c1, ui->m_c2 }; 21 | for (unsigned k = 0; k < sizeof (les) / sizeof (void*); ++k) 22 | { 23 | QString text = les[k]->text (); 24 | if (!text.isEmpty ()) 25 | { 26 | uncrypted = text.toLatin1 (); 27 | #if HIDDENFILES==1 28 | // The AIVCtrl AES256 key and iv 29 | #include "../../Hidden-Files/aes256.h" 30 | #else 31 | // The example AES256 key and iv to build from GitHub. 32 | #include "../upnp/aes256.h" 33 | #endif 34 | QByteArray hashKey = QCryptographicHash::hash (key, QCryptographicHash::Sha256); 35 | QByteArray hashIV = QCryptographicHash::hash (iv, QCryptographicHash::Sha256); 36 | crypted = CAESEncryption::Crypt (CAESEncryption::AES_256, CAESEncryption::CBC, uncrypted, hashKey, hashIV); 37 | crypted = crypted.toBase64 (); 38 | } 39 | else 40 | { 41 | crypted = "Nothing to crypt."; 42 | } 43 | 44 | las[k]->setText (crypted); 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /upnp/transportsettings.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TRANSPORT_SETTINGS_HPP 2 | #define TRANSPORT_SETTINGS_HPP 3 | 4 | #include "using_upnp_namespace.hpp" 5 | #include "upnp_global.hpp" 6 | #include 7 | 8 | START_DEFINE_UPNP_NAMESPACE 9 | 10 | struct STransportSettingsData; 11 | 12 | /*! \brief The CTransportSettings class holds information about GetTransportSettings action. 13 | * 14 | * See http://upnp.org/specs/av/UPnP-av-AVTransport-Service.pdf. 15 | * 16 | * \remark Use implicit Sharing QT technology. 17 | */ 18 | class UPNP_API CTransportSettings 19 | { 20 | public: 21 | /*! Default constructor. */ 22 | CTransportSettings (); 23 | 24 | /*! Copy constructor. */ 25 | CTransportSettings (const CTransportSettings &); 26 | 27 | /*! Equal operator. */ 28 | CTransportSettings& operator = (const CTransportSettings &); 29 | 30 | /*! Destructor. */ 31 | ~CTransportSettings (); 32 | 33 | /*! Sets the play mode. */ 34 | void setPlayMode (QString const & mode); 35 | 36 | /*! Sets the record quality. */ 37 | void setRecQualityMode (QString const & mode); 38 | 39 | /*! Returns the play mode. */ 40 | QString const & playMode () const; 41 | 42 | /*! Returns the record quality. */ 43 | QString const & recQualityMode () const; 44 | 45 | private: 46 | QSharedDataPointer m_d; //!< Shared data pointer. 47 | }; 48 | 49 | } //Namespace 50 | 51 | #endif // TRANSPORT_SETTINGS_HPP 52 | -------------------------------------------------------------------------------- /upnp/control.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CONTROL_HPP 2 | #define CONTROL_HPP 3 | 4 | #include "using_upnp_namespace.hpp" 5 | #include "upnp_global.hpp" 6 | #include 7 | 8 | START_DEFINE_UPNP_NAMESPACE 9 | 10 | class CControlPoint; 11 | class CActionInfo; 12 | 13 | /*! \brief The base class for UPnP/AV specific objects (CConnectionManager, CAVTransport...). 14 | * 15 | * The CControl class is the base class for 16 | * \li CConnectionManager 17 | * \li CContentDirectory 18 | * \li 19 | * \li CRenderingContro 20 | */ 21 | class UPNP_API CControl 22 | { 23 | public: 24 | /*! Default constructor. */ 25 | CControl () {} 26 | 27 | /*! Constructor. */ 28 | CControl (CControlPoint* cp) : m_cp (cp) {} 29 | 30 | /*! Sets the application control point. */ 31 | void setControlPoint (CControlPoint* cp) { m_cp = cp; } 32 | 33 | /*! Returns the control point. */ 34 | CControlPoint* controlPoint () { return m_cp; } 35 | 36 | /*! Returns a string list corresponding at CVS format (values separated by comma). */ 37 | QStringList fromCVS (QString entryString); 38 | 39 | /*! Returns a boolean value corresponding at a string. 40 | * True is returned if entryString doesn't start by '0' or 'f' or 'F'; 41 | */ 42 | static bool toBool (QString const & entryString); 43 | 44 | protected : 45 | CControlPoint* m_cp = nullptr; //(m_d->m_dir); 49 | } 50 | 51 | QString const & CArgument::relatedStateVariable () const 52 | { 53 | return m_d->m_relatedStateVariable; 54 | } 55 | 56 | void CArgument::setDir (EDir dir) 57 | { 58 | m_d->m_dir = dir; 59 | } 60 | 61 | void CArgument::setRelatedStateVariable (QString const & var) 62 | { 63 | m_d->m_relatedStateVariable = var; 64 | } 65 | -------------------------------------------------------------------------------- /upnp/argument.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ARGUMENT_HPP 2 | #define ARGUMENT_HPP 3 | 4 | #include "using_upnp_namespace.hpp" 5 | #include "upnp_global.hpp" 6 | #include 7 | 8 | START_DEFINE_UPNP_NAMESPACE 9 | 10 | /*! Forward CArgument data. */ 11 | struct SArgumentData; 12 | 13 | /*! \brief The CArgument class holds information about an action argument. 14 | * 15 | * \remark Use implicit Sharing QT technology. 16 | */ 17 | class UPNP_API CArgument 18 | { 19 | public: 20 | /*! Direction of the variable. */ 21 | enum EDir { Unknown, //!< Unknown direction. 22 | In, //!< The value is sent. 23 | Out //!< The value is returned. 24 | }; 25 | 26 | /*! Defaut constructor. */ 27 | CArgument (); 28 | 29 | /*! Copy constructor. */ 30 | CArgument (CArgument const & other); 31 | 32 | /*! Equal operator. */ 33 | CArgument& operator = (CArgument const & other); 34 | ~CArgument (); 35 | 36 | /*! Returns the direction of the argument. */ 37 | EDir dir () const; 38 | 39 | /*! Returns the related variable name. */ 40 | QString const & relatedStateVariable () const; 41 | 42 | /*! Sets the direction of the argument. */ 43 | void setDir (EDir dir); 44 | 45 | /*! Sets the name of the related variable. */ 46 | void setRelatedStateVariable (QString const & var); 47 | 48 | private: 49 | QSharedDataPointer m_d; //!< Shared data pointer. 50 | }; 51 | 52 | } // Namespace 53 | 54 | #endif // ARGUMENT_HPP 55 | -------------------------------------------------------------------------------- /upnp/xmlhdidllite.hpp: -------------------------------------------------------------------------------- 1 | #ifndef XMLH_DIDL_LITE_HPP 2 | #define XMLH_DIDL_LITE_HPP 3 | 4 | #include "xmlh.hpp" 5 | #include "didlitem.hpp" 6 | 7 | START_DEFINE_UPNP_NAMESPACE 8 | 9 | /*! \brief Provides the implementation of the DIDL-Lite server response parser. 10 | * At the end of the parsing, this class contains the item list and their elements. 11 | */ 12 | class CXmlHDidlLite : public CXmlH 13 | { 14 | public: 15 | /*! Default constructor. */ 16 | CXmlHDidlLite (); 17 | 18 | /*! The reader calls this function when it has parsed a start element tag. 19 | * See QXmlContentHandler documentation. 20 | */ 21 | virtual bool startElement (QString const & namespaceURI, QString const & localName, QString const & qName, QXmlAttributes const & atts); 22 | 23 | /*! The parser calls this function when it has parsed a chunk of character data 24 | * See QXmlContentHandler documentation. 25 | */ 26 | virtual bool characters (QString const & name); 27 | 28 | /*! Returns the lists of item components as a constant reference. */ 29 | QList const & items () const { return m_items; } 30 | 31 | /*! Returns the first item of the item list. */ 32 | CDidlItem firstItem (QString const & didlLite); 33 | 34 | /*! Returns the first item of the item list. */ 35 | CDidlItem firstItem (QByteArray const & data); 36 | 37 | private : 38 | QList m_items; //!< item list. See CDidlIem. 39 | }; 40 | 41 | } // Namespace 42 | 43 | #endif // XMLH_DIDL_LITE_HPP 44 | -------------------------------------------------------------------------------- /aivctrl/aivwidgets/upnpwidgets.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2017-09-21T14:12:21 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += widgets network 8 | 9 | TARGET = upnpwidgets 10 | TEMPLATE = lib 11 | 12 | DEFINES += UPNPWIDGETS_LIBRARY 13 | 14 | win32 { 15 | DEFINES += UPNP_EXPORTS _WIN32_WINNT=0x0600 16 | CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../upnp/release/ -llibqtupnp 17 | else:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../upnp/debug/ -llibqtupnp 18 | } 19 | 20 | unix { 21 | LIBS += $$OUT_PWD/../upnp/libqtupnp.a 22 | PRE_TARGETDEPS += $$OUT_PWD/../upnp/libqtupnp.a 23 | } 24 | 25 | SOURCES += \ 26 | contentdirectorybrowser.cpp \ 27 | devicebrowser.cpp \ 28 | playlistbrowser.cpp \ 29 | folderbrowser.cpp \ 30 | listwidgetbase.cpp \ 31 | widgethelper.cpp \ 32 | textmetadata.cpp \ 33 | cover.cpp \ 34 | position.cpp \ 35 | slider.cpp \ 36 | mydevicebrowser.cpp \ 37 | networkprogress.cpp 38 | 39 | HEADERS +=\ 40 | upnpwidgets_global.hpp \ 41 | contentdirectorybrowser.hpp \ 42 | devicebrowser.hpp \ 43 | playlistbrowser.hpp \ 44 | folderbrowser.hpp \ 45 | listwidgetbase.hpp \ 46 | widgethelper.hpp \ 47 | textmetadata.hpp \ 48 | cover.hpp \ 49 | position.hpp \ 50 | slider.hpp \ 51 | mydevicebrowser.hpp \ 52 | networkprogress.hpp 53 | 54 | unix { 55 | target.path = /usr/lib 56 | INSTALLS += target 57 | } 58 | -------------------------------------------------------------------------------- /upnp/devicecaps.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DEVICE_CAPS_HPP 2 | #define DEVICE_CAPS_HPP 3 | 4 | #include "using_upnp_namespace.hpp" 5 | #include "upnp_global.hpp" 6 | #include 7 | 8 | START_DEFINE_UPNP_NAMESPACE 9 | 10 | struct SDeviceCapsData; 11 | 12 | /*! \brief Holds information about GetDeviceCapabilities action. 13 | * 14 | * See http://upnp.org/specs/av/UPnP-av-AVTransport-Service.pdf. 15 | */ 16 | class UPNP_API CDeviceCaps 17 | { 18 | public: 19 | /*! Default constructor. */ 20 | CDeviceCaps (); 21 | 22 | /*! Copy constructor. */ 23 | CDeviceCaps (const CDeviceCaps &); 24 | 25 | /*! Equal operator. */ 26 | CDeviceCaps& operator = (const CDeviceCaps &); 27 | 28 | /*! Destructor. */ 29 | ~CDeviceCaps (); 30 | 31 | /*! Sets the play medias. */ 32 | void setPlayMedias (QStringList const & medias); 33 | 34 | /*! Sets the record media. */ 35 | void setRecMedias (QStringList const & medias); 36 | 37 | /*! Sets the record quality modes. */ 38 | void setRecQualityModes (QStringList const & modes); 39 | 40 | /*! Returns the play medias. */ 41 | QStringList const & playMedias () const; 42 | 43 | /*! QStringList the record media. */ 44 | QStringList const & recMedias () const; 45 | 46 | /*! QStringList the record quality modes. */ 47 | QStringList const & recQualityModes () const; 48 | 49 | private: 50 | QSharedDataPointer m_d; //!< Shared data pointer. 51 | }; 52 | 53 | } //Namespace 54 | 55 | #endif // DEVICE_CAPS_HPP 56 | -------------------------------------------------------------------------------- /upnp/xmlhservice.hpp: -------------------------------------------------------------------------------- 1 | #ifndef XMLH_SERVICE_HPP 2 | #define XMLH_SERVICE_HPP 3 | 4 | #include "xmlh.hpp" 5 | #include "action.hpp" 6 | #include "statevariable.hpp" 7 | 8 | START_DEFINE_UPNP_NAMESPACE 9 | 10 | class CService; 11 | 12 | /*! \brief Provides the implementation of the service response parser. */ 13 | class CXmlHService : public CXmlH 14 | { 15 | public: 16 | /*! Default constructor. */ 17 | CXmlHService (CService& service); 18 | 19 | /*! The reader calls this function when it has parsed a start element tag. 20 | * See QXmlContentHandler documentation. 21 | */ 22 | virtual bool startElement (QString const & namespaceURI, QString const & localName, QString const & qName, QXmlAttributes const & atts); 23 | 24 | /*! The parser calls this function when it has parsed a chunk of character data 25 | * See QXmlContentHandler documentation. 26 | */ 27 | virtual bool characters (QString const & name); 28 | 29 | /*! The reader calls this function when it has parsed a end element tag. 30 | * See QXmlContentHandler documentation. 31 | */ 32 | bool endElement (QString const & namespaceURI, QString const & localName, QString const & qName); 33 | 34 | private : 35 | QPair m_var; //!< The couple name-state variable. 36 | QPair m_action; //!< The couple name-action. 37 | QPair m_arg; //!< The couple name-argument. 38 | CService& m_service; //!< The service to update. 39 | }; 40 | 41 | } // Namespace 42 | 43 | #endif // XMLH_SERVICE_HPP 44 | -------------------------------------------------------------------------------- /upnp/connectionmanager.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CONNECTION_MANAGER_HPP 2 | #define CONNECTION_MANAGER_HPP 3 | 4 | #include "control.hpp" 5 | #include "connectioninfo.hpp" 6 | #include 7 | 8 | START_DEFINE_UPNP_NAMESPACE 9 | 10 | class CControlPoint; 11 | class CActionInfo; 12 | 13 | /*! \brief A wrapper that manages the urn:schemas-upnp-org:service:ConnectionManager:1 14 | * service actions. 15 | */ 16 | class CConnectionManager : public CControl 17 | { 18 | public: 19 | /*! Defines the 2 directions for the protocols. */ 20 | enum EProtocolDir { Source, Sink }; 21 | 22 | /*! Default constructor. */ 23 | CConnectionManager () {} 24 | 25 | /*! Constructor 26 | * \param cp: The control point of the application. 27 | */ 28 | CConnectionManager (CControlPoint* cp) : CControl (cp) {} 29 | 30 | /*! Invokes the GetCurrentConnectionInfo action. 31 | * \param deviceUUID: Device uuid. 32 | * \return The connection info. 33 | */ 34 | CConnectionInfo getCurrentConnectionInfo (QString const & deviceUUID); 35 | 36 | /*! Invokes the >GetProtocolInfos action. 37 | * \param deviceUUID: Renderer uuid. 38 | * \return protocol info. 39 | */ 40 | QVector getProtocolInfos (QString const & deviceUUID); 41 | 42 | /*! Invokes the GetCurrentConnectionIDs action. 43 | * \param deviceUUID: Renderer uuid. 44 | * \return Current connection IDs. 45 | */ 46 | QStringList getCurrentConnectionIDs (QString const & deviceUUID); 47 | }; 48 | 49 | } // Namespace 50 | 51 | #endif // CONNECTION_MANAGER_HPP 52 | -------------------------------------------------------------------------------- /upnp/multicastsocket.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "multicastsocket.hpp" 3 | #include 4 | 5 | USING_UPNP_NAMESPACE 6 | 7 | QHostAddress const CMulticastSocket::upnpMulticastAddr = QHostAddress ("239.255.255.250"); //!< Standard multicast IPV4 address. 8 | QHostAddress const CMulticastSocket::upnpMulticastAddr6 = QHostAddress ("FF02::C"); //!< Standard multicast IPV5 address. 9 | quint16 const CMulticastSocket::upnpMulticastPort = 1900; //!< Standard multicast port. 10 | 11 | CMulticastSocket::CMulticastSocket (QObject* parent) : CUpnpSocket (parent) 12 | { 13 | } 14 | 15 | CMulticastSocket::~CMulticastSocket () 16 | { 17 | bool ok = leaveMulticastGroup (m_group); 18 | if (!ok) 19 | { 20 | qDebug () << "CMulticastSocket::~CMulticastSocket (leaveMulticastGroup):" << m_group.toString ().toLatin1 (); 21 | } 22 | } 23 | 24 | bool CMulticastSocket::initialize (QHostAddress const & bindAddr, QHostAddress const & group) 25 | { 26 | bool success = bind (bindAddr, upnpMulticastPort, QUdpSocket::ReuseAddressHint | QUdpSocket::ShareAddress); 27 | if (success) 28 | { 29 | success = joinMulticastGroup (group); 30 | if (!success) 31 | { 32 | qDebug () << "CMulticastSocket::initialize (joinMulticast):" << upnpMulticastAddr.toString ().toLatin1 (); 33 | } 34 | else 35 | { 36 | m_group = group; 37 | setSocketOption (QAbstractSocket::MulticastTtlOption, 4); 38 | } 39 | } 40 | else 41 | { 42 | qDebug () << "CMulticastSocket::initialize (bind)"; 43 | } 44 | 45 | return success; 46 | } 47 | -------------------------------------------------------------------------------- /aivctrl/session.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SESSION_HPP 2 | #define SESSION_HPP 3 | 4 | #include "../upnp/xmlh.hpp" 5 | #include 6 | #include 7 | 8 | class CSession : public QtUPnP::CXmlH 9 | { 10 | public : 11 | CSession () {} 12 | CSession (QString const & renderer, int volume, int playMode, 13 | bool remainingTime, QRect const & rect, Qt::WindowStates windowStates, 14 | int iconSize, QString const & language, unsigned status); 15 | 16 | virtual bool characters (QString const & name); 17 | 18 | void save (QString fileName = QString ()); 19 | bool restore (QString fileName = QString ()); 20 | 21 | QString standardFilePath (); 22 | 23 | QString const & renderer () const { return m_renderer; } 24 | int volume () const { return m_volume; } 25 | int playMode () const { return m_playMode; } 26 | bool remainingTime () const { return m_remainingTime; } 27 | QRect const & geometry () const { return m_rect; } 28 | Qt::WindowStates windowStates () const { return m_windowStates; } 29 | int iconSize () const { return m_iconSize; } 30 | QString const & language () const { return m_language; } 31 | unsigned status () const { return m_status; } 32 | 33 | void setGeometry (QWidget* widget) const; 34 | 35 | protected : 36 | QString m_renderer; 37 | int m_volume = 0; 38 | int m_playMode = 0; 39 | bool m_remainingTime = false; 40 | QRect m_rect; 41 | Qt::WindowStates m_windowStates = Qt::WindowNoState; 42 | int m_iconSize = 32; 43 | QString m_language; 44 | unsigned m_status = 0; 45 | QString const m_fileName = "session.xml"; 46 | }; 47 | 48 | #endif // SESSION_HPP 49 | -------------------------------------------------------------------------------- /aivctrl/aivwidgets/cover.cpp: -------------------------------------------------------------------------------- 1 | #include "cover.hpp" 2 | #include "widgethelper.hpp" 3 | #include "../upnp/datacaller.hpp" 4 | #include 5 | 6 | USING_UPNP_NAMESPACE 7 | 8 | CCover::CCover (QWidget* parent) : QLabel (parent) 9 | { 10 | } 11 | 12 | void CCover::setImage (QString const & uri) 13 | { 14 | bool defName = true; 15 | if (!uri.isEmpty ()) 16 | { 17 | QByteArray pxmBytes = CDataCaller ().callData (uri, m_imageTimeout); 18 | if (!pxmBytes.isEmpty ()) 19 | { 20 | m_pixmap.loadFromData (pxmBytes); 21 | if (!m_pixmap.isNull ()) 22 | { 23 | defName = false; 24 | } 25 | } 26 | } 27 | 28 | if (defName) 29 | { 30 | m_pixmap = QPixmap (::resIconFullPath (m_defaultPixmap)); 31 | } 32 | 33 | update (); 34 | } 35 | 36 | void CCover::paintEvent (QPaintEvent* event) 37 | { 38 | if (!m_pixmap.isNull ()) 39 | { 40 | float wl = width (), hl = height (); 41 | float wp = m_pixmap.width (), hp = m_pixmap.height (); 42 | float ws = wl / wp; 43 | float hs = hl / hp; 44 | QPixmap pxm; 45 | if (ws < hs) 46 | { 47 | pxm = m_pixmap.scaledToWidth (wl, Qt::SmoothTransformation); 48 | } 49 | else 50 | { 51 | pxm = m_pixmap.scaledToHeight (hl, Qt::SmoothTransformation); 52 | } 53 | 54 | QPainter paint (this); 55 | int x = (wl - pxm.width ()) / 2; 56 | int y = (hl - pxm.height ()) / 2; 57 | if (!isEnabled ()) 58 | { 59 | paint.setOpacity (0.2); 60 | } 61 | 62 | paint.drawPixmap (x, y, pxm); 63 | } 64 | else 65 | { 66 | QLabel::paintEvent (event); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /upnp/avcontrol.hpp: -------------------------------------------------------------------------------- 1 | #ifndef AVCONTROL_HPP 2 | #define AVCONTROL_HPP 3 | 4 | #include "renderingcontrol.hpp" 5 | #include "connectionmanager.hpp" 6 | #include "avtransport.hpp" 7 | #include "contentdirectory.hpp" 8 | 9 | START_DEFINE_UPNP_NAMESPACE 10 | 11 | /*! \brief Encapsulates the action managers requisite to build an 12 | * UPnP/AV control point. 13 | * 14 | * You can use UPnP/AV action managers individually. 15 | */ 16 | class CAVControl 17 | { 18 | public: 19 | /*! Default constructor. */ 20 | CAVControl (); 21 | 22 | /*! Constructor. */ 23 | CAVControl (CControlPoint* cp); 24 | 25 | /*! Sets the application control point. */ 26 | void setControlPoint (CControlPoint* cp); 27 | 28 | /*! Returns the control point. */ 29 | CControlPoint* controlPoint (); 30 | 31 | /*! Returns the connection manager. */ 32 | CConnectionManager& connectionManager () { return m_cm; } 33 | 34 | /*! Returns the content directory manager. */ 35 | CContentDirectory& contentDirectory () { return m_cd; } 36 | 37 | /*! Returns the AVTransport manager. */ 38 | CAVTransport& avTransport () { return m_tr; } 39 | 40 | /*! Returns the rendering control manager. */ 41 | CRenderingControl& renderingControl () { return m_rc; } 42 | 43 | protected : 44 | CConnectionManager m_cm; //!< The connection manager. 45 | CContentDirectory m_cd; //!< The content directory manager. 46 | CAVTransport m_tr; //!< The content AVtransport manager. 47 | CRenderingControl m_rc; //!< The content rendering control manager. 48 | }; 49 | 50 | } // Namespace 51 | 52 | #endif // AVCONTROL_HPP 53 | -------------------------------------------------------------------------------- /chupnp/actionParams.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ACTIONPARAMS_HPP 2 | #define ACTIONPARAMS_HPP 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class CActionParams; 8 | } 9 | 10 | /*! \brief The dialog to enter in parameters, launch an UPnP:AV action. 11 | * 12 | * The result is in the tree. 13 | */ 14 | class CActionParams : public QDialog 15 | { 16 | Q_OBJECT 17 | 18 | public: 19 | enum EStatus { stNoRange, stString, stInteger, stBoolean }; 20 | explicit CActionParams (QWidget* parent = 0); 21 | ~CActionParams (); 22 | 23 | static void setHidden (QList const & ws, bool hide = true); 24 | static bool sendMute (bool& current); 25 | static bool sendVolume(int& current, int min, int max, int step); 26 | static bool sendVolumeDB (int& current, int min, int max); 27 | static bool sendAVTransportURI (QString& current); 28 | static bool sendNextAVTransportURI (QString& current); 29 | static bool sendPPS (QString const & transportState, QString const & action); // PPS = play-pause-stop 30 | static bool sendPN (QString const & action); // PN = previous-next 31 | static bool sendPlayMode (QString& current, QStringList const & allowed); 32 | static bool sendSeek (QString& current, QString const & trackTime); 33 | static bool sendSearch (QString& criteria, QStringList const & allowed); 34 | static bool selectPreset (QString& preset, QStringList const & allowed); 35 | 36 | protected slots : 37 | void on_m_allowed_currentTextChanged (QString const & text); 38 | void on_m_copy_clicked (); 39 | 40 | private: 41 | Ui::CActionParams* m_ui; 42 | }; 43 | 44 | #endif // ACTIONPARAMS_HPP 45 | -------------------------------------------------------------------------------- /upnp/transportsettings.cpp: -------------------------------------------------------------------------------- 1 | #include "transportsettings.hpp" 2 | 3 | START_DEFINE_UPNP_NAMESPACE 4 | 5 | /*! \brief Internal structure of CTransportSettings. */ 6 | struct STransportSettingsData : public QSharedData 7 | { 8 | STransportSettingsData () {} 9 | STransportSettingsData (STransportSettingsData const & other); 10 | 11 | QString m_playMode; 12 | QString m_recQualityMode; 13 | }; 14 | 15 | STransportSettingsData::STransportSettingsData (STransportSettingsData const & other) : QSharedData (other), 16 | m_playMode (other.m_playMode), 17 | m_recQualityMode (other.m_recQualityMode) 18 | { 19 | } 20 | 21 | }//Namespace 22 | 23 | USING_UPNP_NAMESPACE 24 | 25 | CTransportSettings::CTransportSettings () : m_d (new STransportSettingsData) 26 | { 27 | } 28 | 29 | CTransportSettings::CTransportSettings (CTransportSettings const & rhs) : m_d (rhs.m_d) 30 | { 31 | } 32 | 33 | CTransportSettings& CTransportSettings::operator = (CTransportSettings const & rhs) 34 | { 35 | if (this != &rhs) 36 | { 37 | m_d.operator = (rhs.m_d); 38 | } 39 | 40 | return *this; 41 | } 42 | 43 | CTransportSettings::~CTransportSettings () 44 | { 45 | } 46 | 47 | void CTransportSettings::setPlayMode (QString const & mode) 48 | { 49 | m_d->m_playMode = mode; 50 | } 51 | 52 | void CTransportSettings::setRecQualityMode (QString const & mode) 53 | { 54 | m_d->m_recQualityMode = mode; 55 | } 56 | 57 | QString const & CTransportSettings::playMode () const 58 | { 59 | return m_d->m_playMode; 60 | } 61 | 62 | QString const & CTransportSettings::recQualityMode () const 63 | { 64 | return m_d->m_recQualityMode; 65 | } 66 | -------------------------------------------------------------------------------- /upnp/transportinfo.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TRANSPORT_INFO_HPP 2 | #define TRANSPORT_INFO_HPP 3 | 4 | #include "using_upnp_namespace.hpp" 5 | #include "upnp_global.hpp" 6 | #include 7 | 8 | START_DEFINE_UPNP_NAMESPACE 9 | 10 | struct STransportInfoData; 11 | 12 | /*! \brief The CTransportInfo class holds information about GetTransportInfo action. 13 | * 14 | * See http://upnp.org/specs/av/UPnP-av-AVTransport-Service.pdf. 15 | * 16 | * \remark Use implicit Sharing QT technology. 17 | */ 18 | class UPNP_API CTransportInfo 19 | { 20 | public : 21 | /*! Default constructor. */ 22 | CTransportInfo (); 23 | 24 | /*! Copy constructor. */ 25 | CTransportInfo (const CTransportInfo &); 26 | 27 | /*! Equal operator. */ 28 | CTransportInfo& operator = (const CTransportInfo &); 29 | 30 | /*! Destructor. */ 31 | ~CTransportInfo (); 32 | 33 | /*! Sets the current transport state. */ 34 | void setCurrentTransportState (QString const & state); 35 | 36 | /*! Sets the current transport status. */ 37 | void setCurrentTransportStatus (QString const & status); 38 | 39 | /*! Sets the current speed. */ 40 | void setCurrentSpeed (QString const & speed); 41 | 42 | /*! Returns the current transport state. */ 43 | QString const & currentTransportState () const; 44 | 45 | /*! Returns the current transport status. */ 46 | QString const & currentTransportStatus () const; 47 | 48 | /*! Returns the current speed. */ 49 | QString const & currentSpeed () const; 50 | 51 | private: 52 | QSharedDataPointer m_d; //!< Shared data pointer. 53 | }; 54 | 55 | } //Namespace 56 | 57 | #endif // TRANSPORT_INFO_HPP 58 | -------------------------------------------------------------------------------- /aivctrl/aivwidgets/devicebrowser.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DEVICEBROWSER_HPP 2 | #define DEVICEBROWSER_HPP 3 | 4 | #include "listwidgetbase.hpp" 5 | #include "../upnp/device.hpp" 6 | 7 | /*! \brief This class adds CDevice at QListWidgetItem used to display devices. 8 | * It is used to show servers. 9 | */ 10 | class CDeviceBrowserItem : public QListWidgetItem 11 | { 12 | public : 13 | /*! Default constructor. */ 14 | CDeviceBrowserItem (QListWidget* parent = nullptr, int type = Type); 15 | 16 | /*! Constructor with device and default icons. */ 17 | CDeviceBrowserItem (QtUPnP::CDevice const & device, QStringList const & defaultIcons, QListWidget* parent = nullptr, int type = Type); 18 | 19 | /*! Copy constructor. */ 20 | CDeviceBrowserItem (CDeviceBrowserItem const & other); 21 | 22 | /*! Sets the device to the item. */ 23 | void setDevice (QtUPnP::CDevice const & device) { m_device = device; } 24 | 25 | /*! Returns the device of the item. */ 26 | QtUPnP::CDevice const & device () const { return m_device; } 27 | 28 | /*! Update the tooltip. */ 29 | void updateTooltip (); 30 | 31 | private : 32 | QtUPnP::CDevice m_device; //!< The device. 33 | }; 34 | 35 | /*! \brief The CDeviceBrowser class provides an CDeviceBrowserItem list widget. */ 36 | class CDeviceBrowser : public CListWidgetBase 37 | { 38 | Q_OBJECT 39 | 40 | public: 41 | /*! Default constructor. */ 42 | CDeviceBrowser (QWidget* parent = nullptr); 43 | 44 | /*! Adds a device to the list widget. */ 45 | void addItem (QtUPnP::CDevice const & device); 46 | 47 | /*! Deletes a device of the list widget. */ 48 | void delItem (QString const & uuid); 49 | 50 | QIcon icon (QString const & uuid); 51 | }; 52 | 53 | #endif // DEVICEBROWSER_HPP 54 | -------------------------------------------------------------------------------- /aivctrl/playlistchoice.cpp: -------------------------------------------------------------------------------- 1 | #include "playlistchoice.hpp" 2 | #include "helper.hpp" 3 | #include "ui_playlistchoice.h" 4 | #include "aivwidgets/widgethelper.hpp" 5 | 6 | CPlaylistChoice::CPlaylistChoice (QMap const & playlists, QString const & title, CPlaylist::EType type, int cItems, QWidget* parent) : 7 | QDialog (parent), ui (new Ui::CPlaylistChoice), m_playlists (playlists) 8 | { 9 | removeWindowContextHelpButton (this); 10 | ui->setupUi (this); 11 | setTransparentBackGround (ui->m_name); 12 | setTransparentBackGround (ui->m_names); 13 | 14 | QString text = tr ("Playlist name for %1 items"); 15 | text = text.replace ("%1", QString::number (cItems)); 16 | ui->m_label->setText (text); 17 | 18 | setWindowTitle (title); 19 | 20 | QIcon icon = ::resIcon ("playlist"); 21 | for (QMap::const_iterator it = playlists.cbegin (), end = playlists.cend (); it != end; ++it) 22 | { 23 | CPlaylist const & playlist = it.value (); 24 | if (playlist.type () == type) 25 | { 26 | new QListWidgetItem (icon, it.key (), ui->m_names); 27 | } 28 | } 29 | } 30 | 31 | CPlaylistChoice::~CPlaylistChoice () 32 | { 33 | delete ui; 34 | } 35 | 36 | QString CPlaylistChoice::name () const 37 | { 38 | return ui->m_name->text (); 39 | } 40 | 41 | void CPlaylistChoice::on_m_names_itemClicked (QListWidgetItem* item) 42 | { 43 | ui->m_name->setText (item->text ()); 44 | } 45 | 46 | void CPlaylistChoice::on_m_names_itemDoubleClicked (QListWidgetItem* item) 47 | { 48 | ui->m_name->setText (item->text ()); 49 | accept (); 50 | } 51 | 52 | void CPlaylistChoice::on_m_ok_clicked () 53 | { 54 | accept (); 55 | } 56 | 57 | void CPlaylistChoice::on_m_cancel_clicked () 58 | { 59 | reject (); 60 | } 61 | 62 | 63 | -------------------------------------------------------------------------------- /aivctrl/aivwidgets/position.cpp: -------------------------------------------------------------------------------- 1 | #include "position.hpp" 2 | #include "../upnp/avtransport.hpp" 3 | #include "../upnp/helper.hpp" 4 | 5 | USING_UPNP_NAMESPACE 6 | 7 | CPosition::CPosition (QWidget* parent) : CSlider (parent) 8 | { 9 | } 10 | 11 | void CPosition::updatePosition (CControlPoint* cp, QString const & renderer) 12 | { 13 | CAVTransport avt (cp); 14 | m_positionInfo = avt.getPositionInfo (renderer); 15 | if (!m_positionInfo.trackURI ().isEmpty ()) 16 | { 17 | QString const & absTime = m_positionInfo.trackDuration (); // Try track duration member 18 | int absTimeMS = static_cast(::timeToS (absTime)); // Convert to milliseconds. 19 | if (absTimeMS <= 0 || absTimeMS > m_maxAbsTime) 20 | { // Bad abs time. Some renderer defines absTime to string and return 2147483647. Try duration from res elems. 21 | CDidlItem didlItem = m_positionInfo.didlItem (); 22 | QString const & duration = didlItem.duration (-1); // Get first elem with property duration. 23 | absTimeMS = static_cast(::timeToS (duration)); 24 | if (absTimeMS <= 0 || absTimeMS > m_maxAbsTime) 25 | { 26 | setEnabled (false); 27 | return; 28 | } 29 | } 30 | 31 | setEnabled (true); 32 | blockSignals (true); 33 | setMaximum (absTimeMS); 34 | #ifdef Q_OS_MACOS 35 | setTickInterval (absTimeMS / 10); 36 | #endif 37 | QString const & relTime = m_positionInfo.relTime (); 38 | int relTimeMS = static_cast(::timeToS (relTime)); 39 | if (relTimeMS < 0) 40 | { // Bad relTime. 41 | relTimeMS = 0; 42 | } 43 | 44 | if (relTimeMS > absTimeMS) 45 | { // Bad real time. 46 | relTimeMS = absTimeMS; 47 | } 48 | 49 | setValue (relTimeMS); 50 | blockSignals (false); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /aivctrl/sliderslots.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.hpp" 2 | #include "ui_mainwindow.h" 3 | #include "../upnp/renderingcontrol.hpp" 4 | #include "../upnp/avtransport.hpp" 5 | 6 | USING_UPNP_NAMESPACE 7 | 8 | void CMainWindow::on_m_volume_valueChanged (int volume) 9 | { 10 | if (!ui->m_volume->signalsBlocked ()) 11 | { 12 | searchAction (false); 13 | CRenderingControl (m_cp).setVolume (m_renderer, volume); 14 | } 15 | } 16 | 17 | void CMainWindow::on_m_volume2_valueChanged (int volume) 18 | { 19 | if (!ui->m_volume->signalsBlocked ()) 20 | { 21 | searchAction (false); 22 | CRenderingControl (m_cp).setVolume (m_renderer, volume); 23 | } 24 | } 25 | 26 | void CMainWindow::on_m_position_valueChanged (int position) 27 | { 28 | if (!ui->m_position->signalsBlocked ()) 29 | { 30 | searchAction (false); 31 | QTime time = QTime (0, 0).addSecs (position); 32 | QString timePosition = time.toString ("hh:mm:ss"); 33 | 34 | bool restart = false; 35 | if (m_positionTimer.isActive ()) 36 | { 37 | restart = true; 38 | m_positionTimer.stop (); 39 | } 40 | 41 | CAVTransport (m_cp).seek (m_renderer, timePosition); 42 | if (restart) 43 | { 44 | startPositionTimer (); 45 | } 46 | } 47 | } 48 | 49 | void CMainWindow::on_m_volume_actionTriggered (int action) 50 | { 51 | searchAction (false); 52 | static_cast(sender ())->jumpToMousePosition (action); 53 | } 54 | 55 | void CMainWindow::on_m_volume2_actionTriggered (int action) 56 | { 57 | searchAction (false); 58 | static_cast(sender ())->jumpToMousePosition (action); 59 | } 60 | 61 | void CMainWindow::on_m_position_actionTriggered (int action) 62 | { 63 | CSlider* slider = static_cast(sender ()); 64 | searchAction (false); 65 | slider->jumpToMousePosition (action); 66 | } 67 | -------------------------------------------------------------------------------- /upnp/xmlhdevice.hpp: -------------------------------------------------------------------------------- 1 | #ifndef XMLH_DEVICE_HPP 2 | #define XMLH_DEVICE_HPP 3 | 4 | #include "xmlh.hpp" 5 | #include 6 | 7 | START_DEFINE_UPNP_NAMESPACE 8 | 9 | class CDevice; 10 | 11 | /*! \brief Provides the implementation of the device response parser. */ 12 | class CXmlHDevice : public CXmlH 13 | { 14 | public: 15 | enum ETempService { Id, Type, ScpdURL, ControlURL, EventSubURL, Last }; 16 | typedef std::array TTempService; 17 | 18 | /*! Default constructor. */ 19 | CXmlHDevice (CDevice& device); 20 | 21 | /*! The reader calls this function when it has parsed a start element tag. 22 | * See QXmlContentHandler documentation. 23 | */ 24 | virtual bool startElement (QString const & namespaceURI, QString const & localName, QString const & qName, QXmlAttributes const & atts); 25 | 26 | /*! The parser calls this function when it has parsed a chunk of character data 27 | * See QXmlContentHandler documentation. 28 | */ 29 | virtual bool characters (QString const & name); 30 | 31 | /*! The reader calls this function when it has parsed an end element tag. 32 | * See QXmlContentHandler documentation. 33 | */ 34 | virtual bool endElement (QString const & namespaceURI, QString const & localName, QString const & qName); 35 | 36 | private : 37 | CDevice& m_device; //!< The device to updated. 38 | QStack> m_tempServices; //!* The stack of services for the device and each embeded devices. 39 | QStack m_subDevices; //!* The stack of embeded devices. 40 | CDevice* m_current = nullptr; //!< Current parsed device. 41 | QString m_urlBase; //!< base url in case of embedded devices. 42 | bool m_deviceList = false; //!< The xml contains a device list tag. 43 | }; 44 | 45 | } // Namespace 46 | 47 | #endif // XMLH_DEVICE_HPP 48 | -------------------------------------------------------------------------------- /upnp/devicecaps.cpp: -------------------------------------------------------------------------------- 1 | #include "devicecaps.hpp" 2 | 3 | START_DEFINE_UPNP_NAMESPACE 4 | 5 | /*! \brief Internal strucure for CDeviceCaps. */ 6 | struct SDeviceCapsData : public QSharedData 7 | { 8 | SDeviceCapsData () {} 9 | SDeviceCapsData (SDeviceCapsData const & other); 10 | 11 | QStringList m_playMedias; 12 | QStringList m_recMedias; 13 | QStringList m_recQualityModes; 14 | }; 15 | 16 | SDeviceCapsData::SDeviceCapsData (SDeviceCapsData const & other) : QSharedData (other), 17 | m_playMedias (other.m_playMedias), 18 | m_recMedias (other.m_recMedias), 19 | m_recQualityModes (other.m_recQualityModes) 20 | { 21 | } 22 | 23 | }//Namespace 24 | 25 | USING_UPNP_NAMESPACE 26 | 27 | CDeviceCaps::CDeviceCaps () : m_d (new SDeviceCapsData) 28 | { 29 | } 30 | 31 | CDeviceCaps::CDeviceCaps (CDeviceCaps const & rhs) : m_d (rhs.m_d) 32 | { 33 | } 34 | 35 | CDeviceCaps& CDeviceCaps::operator = (CDeviceCaps const & rhs) 36 | { 37 | if (this != &rhs) 38 | { 39 | m_d.operator = (rhs.m_d); 40 | } 41 | 42 | return *this; 43 | } 44 | 45 | CDeviceCaps::~CDeviceCaps () 46 | { 47 | } 48 | 49 | void CDeviceCaps::setPlayMedias (QStringList const & medias) 50 | { 51 | m_d->m_playMedias = medias; 52 | } 53 | 54 | void CDeviceCaps::setRecMedias (QStringList const & medias) 55 | { 56 | m_d->m_recMedias = medias; 57 | } 58 | 59 | void CDeviceCaps::setRecQualityModes (QStringList const & modes) 60 | { 61 | m_d->m_recQualityModes = modes; 62 | } 63 | 64 | QStringList const & CDeviceCaps::playMedias () const 65 | { 66 | return m_d->m_playMedias; 67 | } 68 | 69 | QStringList const & CDeviceCaps::recMedias () const 70 | { 71 | return m_d->m_recMedias; 72 | } 73 | 74 | QStringList const & CDeviceCaps::recQualityModes () const 75 | { 76 | return m_d->m_recQualityModes; 77 | } 78 | -------------------------------------------------------------------------------- /chupnp/search.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | CSearch 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Qt::Horizontal 24 | 25 | 26 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | buttonBox 39 | accepted() 40 | CSearch 41 | accept() 42 | 43 | 44 | 248 45 | 254 46 | 47 | 48 | 157 49 | 274 50 | 51 | 52 | 53 | 54 | buttonBox 55 | rejected() 56 | CSearch 57 | reject() 58 | 59 | 60 | 316 61 | 260 62 | 63 | 64 | 286 65 | 274 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /changelog: -------------------------------------------------------------------------------- 1 | version 1.1.4 2 | - Improvements 3 | * Add Qt 5.12.3 64 bits for Windows 4 | * Fix warnings for gcc with Qt 5.12.3. 5 | * Better C++11 conformance. 6 | * Add MacOS Mojave 10.14. 7 | 8 | - Known issues 9 | * On MacOS the slider volume does not have the right dimension. The good dimension is ok when the user click on. 10 | 11 | version 1.1.3 12 | - Improvements 13 | * Change the icon size from 16 to 128 pixels. 14 | * Automatic track advance without SetNextAVTransportURI action and unimplemented playlist format. 15 | * Hide cloud servers. 16 | * New icons. 17 | * Add scripts to build chupnp and AIVCtrl on Fedora systems. Thank's to Przemo Firszt for his contribution. 18 | 19 | - Bugs 20 | * Boolean UPnP parameters send "0" or "1" in place of "false" or "true" (not really a bug). 21 | * Add QAction include file in variousslots.cpp to prevent build fails with different Qt version. Thank again to Przemo Firszt for his contribution. 22 | 23 | 24 | Version 1.1.2 25 | - Improvements 26 | * Subscribe at a only a subset of evented services. It is possible to disable some services for subscription. 27 | It is to limit the number of unused UPnP events in case of many devices on the same network (IoT). 28 | * Get the current list of devices to store it (to simplify the discovery in case of known devices). 29 | * Restore the previous list of devices before discovery (to simplify the discovery in case of known devices). 30 | * Add MacOS support. 31 | * Add Rasbian support (tested on a Raspberry PI3 using QT 5.7). 32 | * Add bash files to build chupnp and aivctrl without using QtCreator (folder linux-build). 33 | 34 | - Bugs 35 | * Add some code protections when IPV6 is not valid (detected on certain MacOS). 36 | * Fix crash when devices and embedded devices have the same uuid (e.g. "SuperHub 3" router from "Virgin" ISP). 37 | * Change code to remove some good warnings generated by Clang. 38 | * Fix video size greater than 4Gbytes. 39 | 40 | 41 | -------------------------------------------------------------------------------- /upnp/transportinfo.cpp: -------------------------------------------------------------------------------- 1 | #include "transportinfo.hpp" 2 | 3 | START_DEFINE_UPNP_NAMESPACE 4 | 5 | /*! \brief Internal structure of CTransportInfo. */ 6 | struct STransportInfoData : public QSharedData 7 | { 8 | STransportInfoData () {} 9 | STransportInfoData (STransportInfoData const & other); 10 | 11 | QString m_currentTransportState; 12 | QString m_currentTransportStatus; 13 | QString m_currentSpeed = "1"; 14 | }; 15 | 16 | STransportInfoData::STransportInfoData (STransportInfoData const & other) : QSharedData (other), 17 | m_currentTransportState (other.m_currentTransportState), 18 | m_currentTransportStatus (other.m_currentTransportStatus), 19 | m_currentSpeed (other.m_currentSpeed) 20 | { 21 | } 22 | 23 | }//Namespace 24 | 25 | USING_UPNP_NAMESPACE 26 | 27 | CTransportInfo::CTransportInfo () : m_d (new STransportInfoData) 28 | { 29 | } 30 | 31 | CTransportInfo::CTransportInfo (CTransportInfo const & rhs) : m_d (rhs.m_d) 32 | { 33 | } 34 | 35 | CTransportInfo& CTransportInfo::operator = (CTransportInfo const & rhs) 36 | { 37 | if (this != &rhs) 38 | { 39 | m_d.operator = (rhs.m_d); 40 | } 41 | 42 | return *this; 43 | } 44 | 45 | CTransportInfo::~CTransportInfo () 46 | { 47 | } 48 | 49 | void CTransportInfo::setCurrentTransportState (QString const & state) 50 | { 51 | m_d->m_currentTransportState = state; 52 | } 53 | 54 | void CTransportInfo::setCurrentTransportStatus (QString const & status) 55 | { 56 | m_d->m_currentTransportStatus = status; 57 | } 58 | 59 | void CTransportInfo::setCurrentSpeed (QString const & speed) 60 | { 61 | m_d->m_currentSpeed = speed; 62 | } 63 | 64 | QString const & CTransportInfo::currentTransportState () const 65 | { 66 | return m_d->m_currentTransportState; 67 | } 68 | 69 | QString const & CTransportInfo::currentTransportStatus () const 70 | { 71 | return m_d->m_currentTransportStatus; 72 | } 73 | 74 | QString const & CTransportInfo::currentSpeed () const 75 | { 76 | return m_d->m_currentSpeed; 77 | } 78 | 79 | 80 | -------------------------------------------------------------------------------- /aivctrl/install/pi32/build.sh: -------------------------------------------------------------------------------- 1 | clear 2 | PRODUCT=aivctrl 3 | # 4 | echo 5 | echo "********************** Build $PRODUCT *************************" 6 | QTDIR=/usr/lib/arm-linux-gnueabihf/qt5 7 | DEVEL=/home/$USER/Devel/QtUPnP 8 | OUTPUT=$DEVEL/$PRODUCT/install/pi32/Output 9 | TARGET=$OUTPUT/debian/usr/bin/$PRODUCT 10 | BINARIES=/home/$USER/Devel/build-$PRODUCT-Desktop-Release 11 | VERSION=1.1.4 12 | echo "$TARGET" 13 | if [ -d $TARGET ] 14 | then 15 | echo "Remove $TARGET" 16 | rm -r $TARGET 17 | fi 18 | # 19 | if [ -f $OUTPUT/$PRODUCT-$VERSION.deb ] 20 | then 21 | echo "Remove $OUTPUT/$PRODUCT-$VERSION.deb" 22 | chmod +w $OUTPUT/$PRODUCT-$VERSION.deb 23 | rm $OUTPUT/$PRODUCT-$VERSION.deb 24 | fi 25 | # 26 | if [ -f $OUTPUT/$PRODUCT-$VERSION.zip ] 27 | then 28 | echo "Remove $OUTPUT/$PRODUCT-$VERSION.zip" 29 | chmod +w $OUTPUT/$PRODUCT-$VERSION.zip 30 | rm $OUTPUT/$PRODUCT-$VERSION.zip 31 | fi 32 | # 33 | mkdir "$TARGET" 34 | # 35 | echo "Copy binary files" 36 | cp $BINARIES/$PRODUCT/$PRODUCT $TARGET/$PRODUCT 37 | cp ../../icons/*48.png $TARGET 38 | cp $DEVEL/$PRODUCT/install/linux64/$PRODUCT $TARGET/$PRODUCT.run 39 | # 40 | echo "Copy plugins files" 41 | mkdir $TARGET/plugins 42 | cp $BINARIES/$PRODUCT/plugins/*.* $TARGET/plugins 43 | 44 | echo "Copy translation files" 45 | mkdir $TARGET/languages 46 | cp ../../languages/*_??.qm $TARGET/languages 47 | cp ../../languages/*.png $TARGET/languages 48 | # 49 | echo "Copy .destktop file" 50 | cp $OUTPUT/*.desktop $TARGET 51 | # 52 | echo "Copy Qt Images plugins" 53 | mkdir $TARGET/imageformats 54 | cp $QTDIR/plugins/imageformats/*.* $TARGET/imageformats 55 | # 56 | echo "Copy Qt Bearer plugins" 57 | mkdir $TARGET/bearer 58 | cp $QTDIR/plugins/bearer/*.* $TARGET/bearer 59 | # 60 | echo "Copy Qt platforms" 61 | mkdir $TARGET/platforms 62 | cp $QTDIR/plugins/platforms/*.* $TARGET/platforms 63 | # 64 | echo "Copy Qt binary files" 65 | cp $QTDIR/bin/linguist $TARGET 66 | # 67 | echo "Build debian package" 68 | cd Output 69 | chmod 755 debian/DEBIAN/post* 70 | chmod 755 debian/DEBIAN/pre* 71 | dpkg-deb --build debian $PRODUCT-pi3-$VERSION.deb 72 | echo "End of build" 73 | -------------------------------------------------------------------------------- /upnp/devicepixmap.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DEVICE_PIXMAP_HPP 2 | #define DEVICE_PIXMAP_HPP 3 | 4 | #include "using_upnp_namespace.hpp" 5 | #include "upnp_global.hpp" 6 | #include 7 | 8 | START_DEFINE_UPNP_NAMESPACE 9 | 10 | struct SDevicePixmapData; 11 | 12 | /*! \brief The CDevicePixmap class holds information about a device image. 13 | * 14 | * \remark Use implicit Sharing QT technology. 15 | */ 16 | class UPNP_API CDevicePixmap 17 | { 18 | public: 19 | /*! Default constructor. */ 20 | CDevicePixmap (); 21 | 22 | /*! Copy constructor. */ 23 | CDevicePixmap (const CDevicePixmap & other); 24 | 25 | /*! Equal operator. */ 26 | CDevicePixmap& operator = (CDevicePixmap const & other); 27 | 28 | /*! Destructor. */ 29 | ~CDevicePixmap (); 30 | 31 | /*! Sets the image url. */ 32 | void setUrl (QString const & url); 33 | 34 | /*! Sets the mime type. */ 35 | void setMimeType (QString mimeType); 36 | 37 | /*! Sets the width. */ 38 | void setWidth (int w); 39 | 40 | /*! Sets the height. */ 41 | void setHeight ( int h); 42 | 43 | /*! Sets the depth. */ 44 | void setDepth (int d); 45 | 46 | /*! Returns the image url. */ 47 | QString const & url () const; 48 | 49 | /*! Returns the mime type. */ 50 | QString const & mimeType () const; 51 | 52 | /*! Returns the width. */ 53 | int width () const; 54 | 55 | /*! Returns the height. */ 56 | int height () const; 57 | 58 | /*! Returns the depth. */ 59 | int depth () const; 60 | 61 | /*! Return the prefered criteria. It is width * height * depth. */ 62 | int preferedCriteria () const; 63 | 64 | /*! Returns true if the image has the mimeTpe. */ 65 | bool hasMimeType (char const * mimeType) const; 66 | 67 | /*! Return the prefered criteria. It is width * height * depth. */ 68 | static int preferedCriteria (int w, int h, int d) { return w * h * d; } 69 | 70 | private: 71 | QSharedDataPointer m_d; //!< Shared data pointer. 72 | }; 73 | 74 | } // Namespace 75 | 76 | #endif // DEVICE_PIXMAP_HPP 77 | -------------------------------------------------------------------------------- /aivctrl/helper.cpp: -------------------------------------------------------------------------------- 1 | #include "helper.hpp" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | QString tempDirectory () 10 | { 11 | return QStandardPaths::standardLocations (QStandardPaths::TempLocation).first (); 12 | } 13 | 14 | QString appDataDirectory () 15 | { 16 | QString folder; 17 | QStringList folders = QStandardPaths::standardLocations (QStandardPaths::AppDataLocation); 18 | if (!folders.isEmpty ()) 19 | { 20 | folder = folders.first (); 21 | QDir appDataFolder (folder); 22 | if (!appDataFolder.exists (folder)) 23 | { 24 | appDataFolder.mkpath (folder); 25 | } 26 | } 27 | 28 | return folder; 29 | } 30 | 31 | QString appBaseName () 32 | { 33 | QFileInfo fi (appFilePath ()); 34 | return fi.baseName (); 35 | } 36 | 37 | QString appFilePath () 38 | { 39 | return QCoreApplication::applicationFilePath (); 40 | } 41 | 42 | QString appFileDir () 43 | { 44 | QFileInfo fileInfo (appFilePath ()); 45 | return fileInfo.absolutePath (); 46 | } 47 | 48 | QString errorFilePath () 49 | { 50 | QDir dir (tempDirectory ()); 51 | QString fileName = appBaseName () + "-dump-errors" + ".txt"; 52 | return dir.absoluteFilePath (fileName); 53 | } 54 | 55 | void dumpError (QString const & text) 56 | { 57 | QFile file (errorFilePath ()); 58 | file.open (QIODevice::Append | QIODevice::Text); 59 | file.write (text.toLatin1 ()); 60 | file.close (); 61 | } 62 | 63 | void removeDumpError () 64 | { 65 | QFile::remove (errorFilePath ()); 66 | } 67 | 68 | QTranslator* installTranslator (QString& locale) 69 | { 70 | if (locale.isEmpty ()) 71 | { 72 | locale = QLocale::system ().name ().section ('_', 0, 0); 73 | } 74 | 75 | QString path = appFileDir () + "/languages/aivctrl_" + locale + ".qm"; 76 | QTranslator* translator = nullptr; 77 | if (QFileInfo::exists (path)) 78 | { 79 | translator = new QTranslator; 80 | translator->load (path); 81 | QCoreApplication::installTranslator (translator); 82 | } 83 | 84 | return translator; 85 | } 86 | 87 | -------------------------------------------------------------------------------- /aivctrl/language.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | CLanguage 4 | 5 | 6 | 7 | 0 8 | 0 9 | 223 10 | 113 11 | 12 | 13 | 14 | Languages 15 | 16 | 17 | 18 | 2 19 | 20 | 21 | 2 22 | 23 | 24 | 2 25 | 26 | 27 | 2 28 | 29 | 30 | 2 31 | 32 | 33 | 34 | 35 | QFrame::NoFrame 36 | 37 | 38 | true 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | Qt::Horizontal 48 | 49 | 50 | 51 | 208 52 | 20 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Ok 61 | 62 | 63 | 64 | 65 | 66 | 67 | Cancel 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /chupnp/stdaction.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | CStdAction 4 | 5 | 6 | 7 | 0 8 | 0 9 | 446 10 | 238 11 | 12 | 13 | 14 | Standard action 15 | 16 | 17 | true 18 | 19 | 20 | 21 | 22 | 23 | In 24 | 25 | 26 | 27 | 28 | 29 | 30 | Out 31 | 32 | 33 | 34 | 35 | 36 | 37 | true 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | Invoke 47 | 48 | 49 | 50 | 51 | 52 | 53 | Qt::Horizontal 54 | 55 | 56 | 57 | 40 58 | 20 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | Close 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /upnp/xmlhdidllite.cpp: -------------------------------------------------------------------------------- 1 | #include "xmlhdidllite.hpp" 2 | 3 | USING_UPNP_NAMESPACE 4 | 5 | CXmlHDidlLite::CXmlHDidlLite () 6 | { 7 | } 8 | 9 | bool CXmlHDidlLite::startElement (QString const & namespaceURI, QString const & localName, QString const & qName, QXmlAttributes const & atts) 10 | { 11 | if (qName != "DIDL-Lite") 12 | { 13 | CXmlH::startElement (namespaceURI, localName, qName, atts); 14 | 15 | TMProps props; 16 | for (int iAtt = 0; iAtt < atts.count (); ++iAtt) 17 | { 18 | QString const & name = atts.qName (iAtt); 19 | QString const & value = atts.value (iAtt); 20 | props[name] = value; 21 | } 22 | 23 | CDidlElem elem; 24 | elem.setProps (props); 25 | if (qName == "item" || qName == "container") 26 | { 27 | CDidlItem item; 28 | item.insert (qName, elem); 29 | m_items.push_back (item); 30 | } 31 | else if (!m_items.isEmpty ()) 32 | { 33 | m_items.last ().insert (qName, elem); 34 | } 35 | } 36 | 37 | return true; 38 | } 39 | 40 | bool CXmlHDidlLite::characters (QString const & name) 41 | { 42 | if (!m_stack.isEmpty () && !m_items.isEmpty () && !name.trimmed ().isEmpty ()) 43 | { 44 | QString const & tag = m_stack.top (); 45 | CDidlItem& item = m_items.last (); 46 | CDidlElem elem = item.value (tag); 47 | elem.setValue (name); 48 | item.replace (tag, elem); 49 | } 50 | 51 | return true; 52 | } 53 | 54 | CDidlItem CXmlHDidlLite::firstItem (QByteArray const & data) 55 | { 56 | CDidlItem item; 57 | bool success = parse (data); 58 | if (success && !m_items.isEmpty ()) 59 | { 60 | item = m_items.first (); 61 | } 62 | 63 | return item; 64 | } 65 | 66 | CDidlItem CXmlHDidlLite::firstItem (QString const & didlLite) 67 | { 68 | CDidlItem item; 69 | if (!didlLite.isEmpty () && didlLite != "NOT_IMPLEMENTED") 70 | { 71 | QString data = ampersandHandler (didlLite); 72 | bool success = parse (data); 73 | if (success && !m_items.isEmpty ()) 74 | { 75 | item = m_items.first (); 76 | } 77 | } 78 | 79 | return item; 80 | } 81 | -------------------------------------------------------------------------------- /aivctrl/icons.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.hpp" 2 | #include "ui_mainwindow.h" 3 | 4 | QStringList CMainWindow::serverIcons () 5 | { 6 | return { QString (), 7 | "server", 8 | }; 9 | } 10 | 11 | QStringList CMainWindow::contentDirectoryIcons () 12 | { 13 | return { QString (), //!< unknown 14 | "image", //!< object.item.imageItem 15 | "image", //!< object.item.imageItem.photo 16 | "audio", //!< bject.item.audioItem 17 | "audio", //!< object.item.audioItem.musicTrack 18 | "audio", //!< object.item.audioItem.audioBroadcast 19 | "audio", //!< object.item.audioItem.audioBook 20 | "video", //!< object.item.videoItem 21 | "video", //!< object.item.videoItem.movie 22 | "video", //!< object.item.videoItem.videoBroadcast 23 | "video", //!< object.item.videoItem.musicVideoClip 24 | "text", //!< object.item.textItem 25 | "bookmark", //!< object.item.bookmarkItem 26 | QString (), //!< object.item.epgItem 27 | "audio", //!< object.item.epgItem.audioProgram 28 | "video", //!< object.item.epgItem.videoProgram 29 | "playlist", //!< object.item.playlistItem 30 | "folder", //!< object.container 31 | "folder", //!< object.container.playlistContainer 32 | "music_album", //!< object.container.album.musicAlbum 33 | "photo_album", //!< object.container.album.photoAlbum 34 | "folder", //!< object.container.epgContainer 35 | "folder", //!< object.container.storageSystem 36 | "folder", //!< object.container.storageVolume 37 | "folder", //!< object.container.storageFolder 38 | "folder", //!< object.container.bookmarkFolder 39 | "artist", //!< object.container.person 40 | "artist", //!< object.container.person.musicArtist 41 | "genre", //!< object.container.genre 42 | "genre", //!< object.container.genre.musicGenre 43 | "genre", //!< object.container.genre.movieGenre 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /aivctrl/aivwidgets/playlistbrowser.hpp: -------------------------------------------------------------------------------- 1 | #ifndef PLAYLISTBROWSER_HPP 2 | #define PLAYLISTBROWSER_HPP 3 | 4 | #include "contentdirectorybrowser.hpp" 5 | 6 | namespace QtUPnP 7 | { 8 | class CControlPoint; 9 | } 10 | 11 | /*! \brief Playlist content browser. */ 12 | class CPlaylistBrowser : public CContentDirectoryBrowser 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | /*! Default constructor. */ 18 | CPlaylistBrowser (QWidget* parent); 19 | 20 | /*! Invokes SetAVTransportURI action. */ 21 | void setAVTransportURI (QtUPnP::CControlPoint* cp, QString const & renderer, int itemRow); 22 | 23 | /*! Invokes SetNextAVTransportURI action. */ 24 | void setNextAVTransportURI (QtUPnP::CControlPoint* cp, QString const & renderer); 25 | 26 | /*! Returns the playlist name. */ 27 | QString const & name () const { return m_name; } 28 | 29 | /*! Sets the playlist name. */ 30 | void setName (QString const & name) { m_name = name; } 31 | 32 | /*! Disable/Enable the use of UPnP playlist. */ 33 | void setDisableUPnPPlaylist (bool disable) { m_disableUPnPPlaylist = disable; } 34 | 35 | /*! Returns true the use of UPnP playlist is disable. */ 36 | bool isUPnPPlaylistDisabled () const { return m_disableUPnPPlaylist; } 37 | 38 | /*! Enable/Disable HTTP conversion for HTTPS protocol for streaming. */ 39 | void setDirectStreamHTTPS (bool set) { m_directStreamHTTPS = set; } 40 | 41 | public slots : 42 | /*! Removes an item. */ 43 | void delKey (); 44 | 45 | signals : 46 | /*! An item has been removed. */ 47 | void removeIDs (QString const & name, QStringList const & ids); 48 | 49 | /*! Items has been moved (drag and drop). */ 50 | void rowsMoved (QModelIndex const & parent, int start, int end, QModelIndex const & destination, int row); 51 | 52 | /*! Items are about to moved. */ 53 | void rowsAboutToBeMoved (QModelIndex const & parent, int start, int end, QModelIndex const & destination, int row); 54 | 55 | private : 56 | void replaceNoHttpScheme (QtUPnP::CDidlItem& didlItem); 57 | 58 | protected : 59 | QString m_name; //!< Playlist name. 60 | bool m_disableUPnPPlaylist = false; //!< Do not user playlists. 61 | bool m_directStreamHTTPS = false; //!< The renderer can handle HTTPS protocol. 62 | }; 63 | 64 | #endif // PLAYLISTBROWSER_HPP 65 | -------------------------------------------------------------------------------- /upnp/datacaller.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DATA_CALLER_HPP 2 | #define DATA_CALLER_HPP 1 3 | 4 | #include "using_upnp_namespace.hpp" 5 | #include "upnp_global.hpp" 6 | #include 7 | #include 8 | 9 | class QNetworkAccessManager; 10 | 11 | START_DEFINE_UPNP_NAMESPACE 12 | 13 | /*! \brief Provides the mechanism to ask data from the device. 14 | * 15 | * The data are asked using a QNetworkManager. 16 | */ 17 | class UPNP_API CDataCaller : public QEventLoop 18 | { 19 | Q_OBJECT 20 | 21 | public : 22 | enum ETime { Timeout = 10000 }; //!< HTTP request timeout in ms (10s). 23 | 24 | /*! Default contructor. 25 | * 26 | * The QNetworkAccessManager is created internaly. 27 | */ 28 | CDataCaller (QObject* parent = nullptr); 29 | 30 | /*! Constructor with network access manager. 31 | * 32 | * The internal QNetworkAccessManager is not created. The object use naMgr. 33 | * It is sometimes useful because create and destroy the network access manager 34 | * consumes time. Use this contructor when you want call callData function many times. 35 | */ 36 | CDataCaller (QNetworkAccessManager* naMgr, QObject* parent = nullptr); 37 | 38 | /*! Destructor. */ 39 | ~CDataCaller (); 40 | 41 | /*! Sends a request and return the responds. 42 | * \param url: The request. 43 | * \param timeout: The time out to wait responds in ms. 44 | * \return The array of bytes of the responds. 45 | */ 46 | QByteArray callData (QUrl const & url, int timeout = Timeout); 47 | 48 | /*! Read the request. 49 | * \remark Normally you do not have to call this function. 50 | * \return The array of bytes of the responds. 51 | */ 52 | QByteArray readAll (); 53 | 54 | protected: 55 | /*! This function is called in case of timeout. */ 56 | virtual void timerEvent (QTimerEvent*); 57 | 58 | private slots: 59 | /*! Slot call when the responds if ok. */ 60 | void finished (); 61 | 62 | /*! Slot for network error. */ 63 | void error (QNetworkReply::NetworkError err); 64 | 65 | private : 66 | QString m_request; //!< The request. 67 | QNetworkAccessManager* m_naMgr = nullptr; //!< The current netword access manager. see CDataCaller (QNetworkAccessManager* naMgr, QObject* parent). 68 | }; 69 | 70 | } // End namespace 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /aivctrl/aivwidgets/textmetadata.cpp: -------------------------------------------------------------------------------- 1 | #include "textmetadata.hpp" 2 | 3 | CTextMetaData::CTextMetaData (QWidget* parent) : QTextEdit (parent) 4 | { 5 | QFontMetrics fontMetrics = this->fontMetrics (); 6 | int spacing = fontMetrics.lineSpacing (); 7 | setMaximumHeight (4 * spacing); 8 | setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Fixed); 9 | } 10 | 11 | QString CTextMetaData::truncateText (QString const & text) 12 | { 13 | return truncateText (text, this); 14 | } 15 | 16 | QString CTextMetaData::truncateText (QString const & text, QWidget* widget) 17 | { 18 | char const * suspensionPoint = "..."; 19 | 20 | QString truncatedText = text; 21 | if (!truncatedText.isEmpty () && (truncatedText.size () > 1 || truncatedText[0] != ' ')) 22 | { 23 | QFontMetrics fontMetrics = widget->fontMetrics (); 24 | int textWidth = fontMetrics.width (truncatedText, -1); 25 | int width = 17 * widget->width () / 20; // 15% 26 | if (textWidth >= width) 27 | { 28 | int length = truncatedText.length (); 29 | truncatedText += suspensionPoint; 30 | while (length > 0 && fontMetrics.width (truncatedText, -1) >= width) 31 | { 32 | truncatedText = truncatedText.left (--length) + suspensionPoint; 33 | } 34 | } 35 | } 36 | 37 | return truncatedText; 38 | } 39 | 40 | void CTextMetaData::resizeEvent (QResizeEvent* event) 41 | { 42 | QTextEdit::resizeEvent (event); 43 | updateText (); 44 | } 45 | 46 | void CTextMetaData::updateText () 47 | { 48 | QString const lf = "
"; 49 | QString html = "

"; 50 | if (m_texts.isEmpty ()) 51 | { 52 | m_texts << " "; 53 | } 54 | else if (m_texts.first ().isEmpty ()) 55 | { 56 | m_texts.first () = ' '; 57 | } 58 | 59 | for (QStringList::const_iterator begin = m_texts.cbegin (), it = begin, end = m_texts.cend (); it != end; ++it) 60 | { 61 | if (it != begin) 62 | { 63 | html += lf; 64 | } 65 | 66 | html += truncateText (*it); 67 | } 68 | 69 | html += "

"; 70 | QTextEdit::setHtml (html); 71 | } 72 | 73 | void CTextMetaData::setText (QStringList const & texts) 74 | { 75 | m_texts = texts; 76 | updateText (); 77 | } 78 | 79 | void CTextMetaData::clear () 80 | { 81 | m_texts.clear (); 82 | QTextEdit::clear (); 83 | } 84 | -------------------------------------------------------------------------------- /upnp/connectioninfo.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CONNECTION_INFO_HPP 2 | #define CONNECTION_INFO_HPP 3 | 4 | #include "using_upnp_namespace.hpp" 5 | #include "upnp_global.hpp" 6 | #include 7 | 8 | START_DEFINE_UPNP_NAMESPACE 9 | 10 | struct SConnectionInfoData; 11 | 12 | /*! \brief The CConnectionInfo class holds information about GetCurrentConnectionInfo action. 13 | * 14 | * See http://upnp.org/specs/av/UPnP-av-ConnectionManager-Service.pdf. 15 | * 16 | * \remark Use implicit Sharing QT technology. 17 | */ 18 | class UPNP_API CConnectionInfo 19 | { 20 | public: 21 | /*! Default constructor. */ 22 | CConnectionInfo (); 23 | 24 | /*! Copy constructor. */ 25 | CConnectionInfo (const CConnectionInfo &); 26 | 27 | /*! Equal operator. */ 28 | CConnectionInfo& operator = (const CConnectionInfo &); 29 | 30 | /*! Destructor. */ 31 | ~CConnectionInfo (); 32 | 33 | /*! Sets the Rcs identifier. */ 34 | void setRcsID (int id); 35 | 36 | /*! Sets the AVTransport identifier. */ 37 | void setAVTransportID (int id); 38 | 39 | /*! Sets the protocol information. */ 40 | void setProtocolInfo (QString const & protocol); 41 | 42 | /*! Sets the peer connection manager. */ 43 | void setPeerConnectionManager (QString const & pcm); 44 | 45 | /*! Sets the peer connection identifier. */ 46 | void setPeerConnectionID (int id); 47 | 48 | /*! Sets device the direction. */ 49 | void setDirection (QString const & dir); 50 | 51 | /*! Sets device status. */ 52 | void setStatus (QString const & st); 53 | 54 | /*! Returns the Rcs identifier. */ 55 | int rcsID () const; 56 | 57 | /*! Returns the AVTransport identifier. */ 58 | int avTransportID () const; 59 | 60 | /*! Returns the protocol information. */ 61 | QString const & protocolInfo () const; 62 | 63 | /*! Returns the peer connection manager. */ 64 | QString const & peerConnectionManager () const; 65 | 66 | /*! Returns the peer connection identifier. */ 67 | int peerConnectionID () const; 68 | 69 | /*! Returns device the direction. */ 70 | QString const & direction () const; 71 | 72 | /*! Returns device status. */ 73 | QString const & status () const; 74 | 75 | private: 76 | QSharedDataPointer m_d; //!< Shared data pointer. 77 | }; 78 | 79 | } //Namespace 80 | 81 | #endif // CONNECTION_INFO_HPP 82 | -------------------------------------------------------------------------------- /aivctrl/aivctrl.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icons/settings.png 4 | icons/contextual_actions.png 5 | icons/favorite.png 6 | icons/favorite_true.png 7 | icons/previous.png 8 | icons/speaker_off.png 9 | icons/speaker_on.png 10 | icons/previous_folder.png 11 | icons/queue.png 12 | icons/server.png 13 | icons/next.png 14 | icons/no_album_art.png 15 | icons/audio.png 16 | icons/folder.png 17 | icons/image.png 18 | icons/music_album.png 19 | icons/photo_album.png 20 | icons/video.png 21 | icons/artist.png 22 | icons/home.png 23 | icons/discovery0.png 24 | icons/discovery15.png 25 | icons/discovery30.png 26 | icons/device.png 27 | icons/audio_file_big.png 28 | icons/repeat_off.png 29 | icons/repeat_one.png 30 | icons/repeat_all.png 31 | icons/shuffle_off.png 32 | icons/shuffle_on.png 33 | icons/playing_off.png 34 | icons/playing_on.png 35 | icons/current_playing.png 36 | icons/aivctrl48.ico 37 | icons/playlist.png 38 | icons/add_favorites.png 39 | icons/add_queue.png 40 | icons/delete.png 41 | icons/replace_queue.png 42 | icons/add_playlist.png 43 | icons/search16.png 44 | icons/network16.png 45 | icons/rename.png 46 | icons/genre.png 47 | icons/about.png 48 | icons/language.png 49 | icons/qt.png 50 | icons/favorites.png 51 | icons/renderer.png 52 | icons/search.png 53 | icons/search_cancel.png 54 | icons/bookmark.png 55 | icons/text.png 56 | 57 | 58 | -------------------------------------------------------------------------------- /aivctrl/aivwidgets/widgethelper.hpp: -------------------------------------------------------------------------------- 1 | #ifndef WIDGETHELPER_HPP 2 | #define WIDGETHELPER_HPP 3 | 4 | #include 5 | 6 | class QWidget; 7 | class QListWidget; 8 | class QDialog; 9 | class QStringList; 10 | class QString; 11 | 12 | /*! \brief This file contains functions to refractorize the code. */ 13 | 14 | /*! Calls tooltipFied as being the first field of the tooltip. */ 15 | #define TOOLTIPFIELD1(title,value) tooltipField (QObject::tr (title), value, true) 16 | 17 | /*! Calls tooltipFied as being the non first field of the tooltip. */ 18 | #define TOOLTIPFIELD(title,value) tooltipField (QObject::tr (title), value, false) 19 | 20 | /*! Sets backgroung widget transparent. */ 21 | void setTransparentBackGround (QWidget* widget); 22 | 23 | /*! Sets item mouse over color. */ 24 | void setItemMouseOverColor (QListWidget* widget); 25 | 26 | /*! Removes the windows context help button. */ 27 | void removeWindowContextHelpButton (QDialog* dialog); 28 | 29 | /*! Returns the field value. 30 | * \param title: The title. 31 | * \param value: The QString value. 32 | * \param first: True if this field is the first field. 33 | * \return The field value. 34 | */ 35 | QString tooltipField (QString const & title, QString const & value, bool first = false); 36 | 37 | /*! Same as above with unsigned integer value. */ 38 | QString tooltipField (QString const & title, unsigned value, bool first = false); 39 | 40 | /*! Same as above with unsigned long long integer value. */ 41 | QString tooltipField (QString const & title, unsigned long long value, bool first = false); 42 | 43 | /*! Same as above with double value. */ 44 | QString tooltipField (QString const & title, double value, bool first = false); 45 | 46 | /*! Returns the icon full path. */ 47 | QString resIconFullPath (QString const & name); 48 | 49 | /*! Returns the icon from name. */ 50 | QIcon resIcon (QString const & name); 51 | 52 | /*! Sets the icon directory. By default ":/icons for a resource. */ 53 | void setIconDirRes (QString const & dir); 54 | 55 | /*! Sets the icon suffix. By default ".png". */ 56 | void setIconSuffixRes (QString const & suffix); 57 | 58 | /*! Updates name. 59 | * From a list of existing names, this function returns a new name. 60 | * For example, if name is "New playlist", and if "New playlist" exists in existingNames, 61 | * The function returns "New playlist-2". If "New playlist-2" exists, the return is "New playlist-3". 62 | * and so on. 63 | */ 64 | QString updateName (QString name, QStringList const & existingNames); 65 | 66 | 67 | 68 | #endif // WIDGETHELPER_HPP 69 | -------------------------------------------------------------------------------- /aivctrl/aivwidgets/networkprogress.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NETWORKPROGRESS_HPP 2 | #define NETWORKPROGRESS_HPP 3 | 4 | #include 5 | #include 6 | 7 | /*! \brief This widget draw a pattern to simulate thes network communications. 8 | * 9 | * The patterns are: 10 | * \li Two simple segments. 11 | * \li A plusation. 12 | * \li A binary value. 13 | * When start function is call, the pattern is shown until stop calling or a delay of one second 14 | * if stop commes to fast. 15 | */ 16 | class CNetworkProgress : public QWidget 17 | { 18 | public: 19 | /*! The pattern type. */ 20 | enum EType { Default, //!< 2 segments. 21 | Wave, //!< A plusation. 22 | Binary //!< A binary value between 0 and 32. 23 | }; 24 | 25 | /*! Default constructor. */ 26 | explicit CNetworkProgress (char const * name, QWidget* parent = nullptr); 27 | 28 | /*! Inverts the sens. Left to right for false, right to left for true. */ 29 | void setInverted (bool invert) { m_inverted = invert; } 30 | 31 | /*! Start the pulsations. */ 32 | void start (); 33 | 34 | /*! Stops the pulsations. */ 35 | void stop (); 36 | 37 | /*! Sets the type of pattern. */ 38 | void setType (EType type) { m_type = type; } 39 | 40 | /*! Returns the pattern type. */ 41 | EType type () const { return m_type; } 42 | 43 | /*! Sets the maximum binary value. */ 44 | void setBinaryValue (int value) { m_binaryValue = value; } 45 | 46 | protected slots : 47 | /*! Ready to draw a new plusation. */ 48 | void timeout (); 49 | 50 | /*! Timeout of threshold timer. */ 51 | void fresholdTimerTimeout (); 52 | 53 | protected : 54 | /*! Draw the widget content. */ 55 | virtual void paintEvent (QPaintEvent*); 56 | 57 | private : 58 | QTimer m_timer; //!< Pulsation timer. 59 | QTimer m_fresholdTimer; //!< The minimun delay to clear the pattern after stop. 60 | int m_position = 0; //!< Pulsation position. 61 | int m_lastPosition = 0; //!< Last pulsation position. 62 | int m_timerInteval = 150; //!< Interval betwwen two pulsation. */ 63 | int m_waveWidth = 12; //!< Pulsation width en pixels. 64 | int m_inc = 100000; //!< Increment the pulsation position. See the constant m_invalidInc. (m_inc=m_invalidInc generates a warning with clank). 65 | bool m_inverted = false; //!< Forward or reverse flag. 66 | EType m_type = Default; //!< The pattern type. 67 | int m_binaryValue = 32; //!< The max binray value. */ 68 | 69 | int const m_invalidInc = 100000; //!< Just for initialisation. 70 | }; 71 | 72 | #endif // NETWORKPROGRESS_HPP 73 | -------------------------------------------------------------------------------- /upnp/positioninfo.hpp: -------------------------------------------------------------------------------- 1 | #ifndef POSITION_INFO_HPP 2 | #define POSITION_INFO_HPP 3 | 4 | #include "didlitem.hpp" 5 | #include 6 | 7 | START_DEFINE_UPNP_NAMESPACE 8 | 9 | struct SPositionInfoData; 10 | 11 | /*! \brief The CPositionInfo class holds information about GetPositionInfo action. 12 | * 13 | * See http://upnp.org/specs/av/UPnP-av-AVTransport-Service.pdf. 14 | * 15 | * \remark Use implicit Sharing QT technology. 16 | */ 17 | class UPNP_API CPositionInfo 18 | { 19 | public: 20 | /*! Default constructor. */ 21 | CPositionInfo (); 22 | 23 | /*! Copy constructor. */ 24 | CPositionInfo (const CPositionInfo &); 25 | 26 | /*! Equal operator. */ 27 | CPositionInfo& operator = (const CPositionInfo &); 28 | 29 | /*! Destructor. */ 30 | ~CPositionInfo (); 31 | 32 | /*! Sets the track number. */ 33 | void setTrack (unsigned track); 34 | 35 | /*! Sets the track duration. */ 36 | void setTrackDuration (QString const & trackDuration); 37 | 38 | /*! Sets the track metadata. */ 39 | void setTrackMetaData (QString const & trackMetaData); 40 | 41 | /*! Sets the track uri. */ 42 | void setTrackURI (QString const & trackURI); 43 | 44 | /*! Sets the track real time. */ 45 | void setRelTime (QString const & relTime); 46 | 47 | /*! Sets the track absolute time. */ 48 | void setAbsTime (QString const & absTime); 49 | 50 | /*! Sets the track real count. */ 51 | void setRelCount (int relCount); 52 | 53 | /*! Sets the track absolute count. */ 54 | void setAbsCount (int absCount); 55 | 56 | /*! Returns the track number. */ 57 | unsigned track () const; 58 | 59 | /*! Returns the track duration. */ 60 | QString const & trackDuration () const; 61 | 62 | /*! Returns the track metadata. */ 63 | QString const & trackMetaData () const; 64 | 65 | /*! Returns the track uri. */ 66 | QString const & trackURI () const; 67 | 68 | /*! Returns the track real time. */ 69 | QString const & relTime () const; 70 | 71 | /*! Returns the track metadata. */ 72 | QString const & absTime () const; 73 | 74 | /*! Returns the track real count. */ 75 | int relCount () const; 76 | 77 | /*! Returns the track absolute count. */ 78 | int absCount () const; 79 | 80 | /*! Converts the track metadata in a CDidlItem. */ 81 | CDidlItem didlItem () const; 82 | 83 | private: 84 | QSharedDataPointer m_d; //!< Shared data pointer. 85 | }; 86 | 87 | } //Namespace 88 | 89 | #endif // POSITION_INFO_HPP 90 | -------------------------------------------------------------------------------- /aivctrl/install/win32/build-Qt5123-Mingw73-internal.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem All files and folders for InstallShield or to launch AIVCtrl 4 | set TARGET=build 5 | 6 | rem Product name. 7 | set PRODUCT=aivctrl 8 | 9 | if not exist %TARGET% goto nodel 10 | echo ************* Remove old folder 11 | echo %TARGET% 12 | rmdir %TARGET% /S /Q 13 | 14 | :nodel 15 | 16 | md %TARGET% 17 | 18 | echo ************* Binary files 19 | copy %BINARIES%\%PRODUCT%\release\%PRODUCT%.exe %TARGET% 20 | copy %BINARIES%\upnp\release\QtUPnP.dll %TARGET% 21 | xcopy ..\..\icons\%PRODUCT%48.png %TARGET% 22 | 23 | echo ************* Plugins files 24 | xcopy %BINARIES%\%PRODUCT%\release\plugins\*.* %TARGET%\plugins\*.* 25 | 26 | echo ************* Translation 27 | xcopy ..\..\languages\aivctrl_??.qm "%TARGET%\languages" /Y /I 28 | xcopy ..\..\languages\*.png "%TARGET%\languages" /Y /I 29 | 30 | echo ************* Qt Images plugins 31 | md "%TARGET%\imageformats" 32 | copy "%QTDIR%\plugins\imageformats\qgif.dll" "%TARGET%\imageformats" 33 | copy "%QTDIR%\plugins\imageformats\qicns.dll" "%TARGET%\imageformats" 34 | copy "%QTDIR%\plugins\imageformats\qico.dll" "%TARGET%\imageformats" 35 | copy "%QTDIR%\plugins\imageformats\qjpeg.dll" "%TARGET%\imageformats" 36 | copy "%QTDIR%\plugins\imageformats\qsvg.dll" "%TARGET%\imageformats" 37 | copy "%QTDIR%\plugins\imageformats\qtga.dll" "%TARGET%\imageformats" 38 | copy "%QTDIR%\plugins\imageformats\qtiff.dll" "%TARGET%\imageformats" 39 | copy "%QTDIR%\plugins\imageformats\qwbmp.dll" "%TARGET%\imageformats" 40 | copy "%QTDIR%\plugins\imageformats\qwebp.dll" "%TARGET%\imageformats" 41 | 42 | echo ************* Qt Bearer plugins 43 | md "%TARGET%\bearer" 44 | copy "%QTDIR%\plugins\bearer\qgenericbearer.dll" "%TARGET%\bearer" 45 | 46 | echo ************* Qt platforms 47 | md "%TARGET%\platforms" 48 | copy "%QTDIR%\plugins\platforms\qminimal.dll" "%TARGET%\platforms" 49 | rem copy "%QTDIR%\plugins\platforms\qoffscreen.dll" "%TARGET%\platforms" 50 | copy "%QTDIR%\plugins\platforms\qwindows.dll" "%TARGET%\platforms" 51 | 52 | echo ************* C++ mingw files 53 | copy "%QTDIR%\bin\libgcc_s_dw2-1.dll" %TARGET% 54 | copy "%QTDIR%\bin\libgcc_s_seh-1.dll" %TARGET% 55 | copy "%QTDIR%\bin\libstdc++-6.dll" %TARGET% 56 | copy "%QTDIR%\bin\libwinpthread-1.dll" %TARGET% 57 | 58 | echo ************* Qt binary files 59 | copy %QTDIR%\bin\qt5core.dll %TARGET% 60 | copy %QTDIR%\bin\qt5gui.dll %TARGET% 61 | copy %QTDIR%\bin\qt5xml.dll %TARGET% 62 | copy %QTDIR%\bin\qt5network.dll %TARGET% 63 | copy %QTDIR%\bin\qt5widgets.dll %TARGET% 64 | copy %QTDIR%\bin\linguist.exe %TARGET% 65 | pause 66 | 67 | :end 68 | 69 | -------------------------------------------------------------------------------- /aivctrl/settings.cpp: -------------------------------------------------------------------------------- 1 | #include "settings.hpp" 2 | #include "ui_settings.h" 3 | #include "aivwidgets/widgethelper.hpp" 4 | #include 5 | #include 6 | 7 | CSettings::CSettings (bool* flags, QSize& iconSize, QWidget* parent) : QDialog (parent), 8 | ui (new Ui::CSettings), m_flags (flags), m_iconSize (iconSize) 9 | { 10 | ui->setupUi (this); 11 | removeWindowContextHelpButton (this); 12 | 13 | ui->m_networkCom->setChecked (flags[ShowNetworkCom]); 14 | ui->m_search->setChecked (flags[UseSearchForCheckPlaylist]); 15 | ui->m_eventOnly->setChecked (flags[UPnPEventsOnly]); 16 | ui->m_playlists->setChecked (flags[DontUsePlaylists]); 17 | ui->m_cloudServers->setChecked (flags[ShowCloudServers]); 18 | ui->m_iconSize->setValue (iconSize.width ()); 19 | m_iconSizeBackup = iconSize; 20 | ui->m_size->setText (QString::number (iconSize.width ())); 21 | } 22 | 23 | CSettings::~CSettings () 24 | { 25 | delete ui; 26 | } 27 | 28 | void CSettings::on_m_iconSize_valueChanged (int value) 29 | { 30 | QWidget* mw = static_cast(parent ()); 31 | m_iconSize = QSize (value, value); 32 | ui->m_size->setText (QString::number (value)); 33 | setIconSize (mw, m_iconSize); 34 | m_reset = false; 35 | } 36 | 37 | void CSettings::setIconSize (QWidget* w, QSize const & size) 38 | { 39 | QList tbs = w->findChildren (); 40 | for (QToolButton* tb : tbs) 41 | { 42 | tb->setIconSize (size); 43 | } 44 | 45 | QList listWidgets = w->findChildren (); 46 | for (QListWidget* listWidget : listWidgets) 47 | { 48 | listWidget->setIconSize (size); 49 | listWidget->setSpacing (1); 50 | } 51 | } 52 | 53 | void CSettings::on_m_reset_clicked () 54 | { 55 | ui->m_networkCom->setChecked (true); 56 | ui->m_search->setChecked (false); 57 | ui->m_eventOnly->setChecked (false); 58 | ui->m_playlists->setChecked (false); 59 | ui->m_cloudServers->setChecked (false); 60 | ui->m_iconSize->setValue (32); 61 | m_reset = true; 62 | } 63 | 64 | void CSettings::on_m_ok_clicked () 65 | { 66 | m_flags[ShowNetworkCom] = ui->m_networkCom->isChecked (); 67 | m_flags[UseSearchForCheckPlaylist] = ui->m_search->isChecked (); 68 | m_flags[UPnPEventsOnly] = ui->m_eventOnly->isChecked (); 69 | m_flags[DontUsePlaylists] = ui->m_playlists->isChecked (); 70 | m_flags[ShowCloudServers] = ui->m_cloudServers->isChecked (); 71 | accept (); 72 | } 73 | 74 | void CSettings::on_m_cancel_clicked () 75 | { 76 | on_m_iconSize_valueChanged (m_iconSizeBackup.width ()); 77 | m_reset = false; 78 | reject (); 79 | } 80 | -------------------------------------------------------------------------------- /upnp/didlitem_playlist.cpp: -------------------------------------------------------------------------------- 1 | #include "didlitem.hpp" 2 | #include "helper.hpp" 3 | 4 | USING_UPNP_NAMESPACE 5 | 6 | QByteArray CDidlItem::m3u (QList const & playlistElems) 7 | { 8 | QByteArray content ("#EXTM3U\r\n"); 9 | for (TPlaylistElem const & playlistElem : playlistElems) 10 | { 11 | QList resElems = playlistElem.first.values ("res"); 12 | if (!resElems.isEmpty ()) 13 | { 14 | CDidlItem::sortResElems (resElems); 15 | int index = playlistElem.second; 16 | if (index < 0 || index >= resElems.size ()) 17 | { 18 | index = 0; 19 | } 20 | 21 | CDidlElem const & resElem = resElems[index]; 22 | content += resElem.value ().toLatin1 (); 23 | QString duration = resElem.props ().value ("duration"); 24 | unsigned s = timeToS (duration); 25 | QString const & title = playlistElem.first.value ("dc:title").value (); 26 | content += "\r\n#EXTINF:" + QByteArray::number (s) + ',' + title.toLatin1 () + "\r\n"; 27 | } 28 | } 29 | 30 | content += "\r\n"; 31 | return content; 32 | } 33 | 34 | QByteArray CDidlItem::m3u8 (QList const & playlistElems) 35 | { 36 | QByteArray content ("#EXTM3U\r\n"); 37 | for (TPlaylistElem const & playlistElem : playlistElems) 38 | { 39 | QList const & resElems = playlistElem.first.values ("res"); 40 | if (!resElems.isEmpty ()) 41 | { 42 | int index = playlistElem.second; 43 | if (index < 0 || index >= resElems.size ()) 44 | { 45 | index = 0; 46 | } 47 | 48 | CDidlElem const & resElem = resElems[index]; 49 | content += resElem.value ().toUtf8 (); 50 | QString duration = resElem.props ().value ("duration"); 51 | unsigned s = timeToS (duration); 52 | QString const & title = playlistElem.first.value ("dc:title").value (); 53 | content += "\r\n#EXTINF:" + QByteArray::number (s) + ',' + title.toUtf8 () + "\r\n"; 54 | } 55 | } 56 | 57 | content += "\r\n"; 58 | return content; 59 | } 60 | 61 | QByteArray CDidlItem::buildsPlaylist (QList const & elems, EPlaylistFormat format) 62 | { 63 | QByteArray content; 64 | switch (format) 65 | { 66 | case M3u: 67 | content = m3u (elems); 68 | break; 69 | 70 | case M3u8: 71 | content = m3u8 (elems); 72 | break; 73 | 74 | default: 75 | break; 76 | } 77 | 78 | return content; 79 | } 80 | -------------------------------------------------------------------------------- /upnp/datacaller.cpp: -------------------------------------------------------------------------------- 1 | #include "datacaller.hpp" 2 | #include "dump.hpp" 3 | 4 | USING_UPNP_NAMESPACE 5 | 6 | CDataCaller::CDataCaller (QObject* parent) : QEventLoop (parent), m_naMgr (new QNetworkAccessManager (this)) 7 | { 8 | } 9 | 10 | CDataCaller::CDataCaller (QNetworkAccessManager* naMgr, QObject* parent) : QEventLoop (parent), m_naMgr (naMgr) 11 | { 12 | if (m_naMgr == nullptr) 13 | { 14 | m_naMgr = new QNetworkAccessManager (this); 15 | } 16 | } 17 | 18 | CDataCaller::~CDataCaller () 19 | { 20 | } 21 | 22 | QByteArray CDataCaller::callData (QUrl const & url, int timeout) 23 | { 24 | QByteArray data; // Data returned 25 | if (!url.isEmpty () && !isRunning ()) 26 | { 27 | m_request = url.toString (); 28 | QString scheme = url.scheme (); 29 | if (scheme == "http" || scheme == "https") 30 | { // http or https request 31 | QNetworkRequest nreq (m_request); // Build the network request 32 | QNetworkReply* reply = m_naMgr->get (nreq); // Send the get request and store the reply 33 | 34 | connect (reply, SIGNAL (error(QNetworkReply::NetworkError)), this, SLOT(error(QNetworkReply::NetworkError))); 35 | connect (reply, SIGNAL (finished()), this, SLOT (finished())); 36 | int idTimer = startTimer (timeout); // Start the timeout timer to stop the event loop in case of timeout. 37 | bool success = exec (QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers) == 0 && 38 | reply->error () == QNetworkReply::NoError; 39 | killTimer (idTimer); // The waiting event loop is finished. Kill the timer 40 | if (success) 41 | { 42 | data = reply->readAll (); // Get the reply 43 | } 44 | else 45 | { 46 | QString text = "CDataCaller::callData:" + url.toString (); 47 | CDump::dump (text); 48 | } 49 | 50 | reply->deleteLater (); // Cleanup the reply during the application event loop 51 | } 52 | } 53 | 54 | return data; 55 | } 56 | 57 | // Timeout event. 58 | void CDataCaller::timerEvent (QTimerEvent*) 59 | { 60 | qDebug () << "CDataCaller::timerEvent: Quit on timeout"; 61 | exit (-1); 62 | } 63 | 64 | // Launch by finished signal 65 | void CDataCaller::finished () 66 | { 67 | exit (0); 68 | } 69 | 70 | void CDataCaller::error (QNetworkReply::NetworkError err) 71 | { 72 | auto reply = dynamic_cast(sender ()); 73 | QString error = QString ("Network reply error:%1->%2->%3") 74 | .arg (err).arg (reply->url ().toString (), reply->errorString ()); 75 | qDebug () << "CDataCaller::error: " << err << " (" << error << ")"; 76 | exit (-1); 77 | } 78 | -------------------------------------------------------------------------------- /aivctrl/aivwidgets/slider.cpp: -------------------------------------------------------------------------------- 1 | #include "slider.hpp" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | CSlider::CSlider (QWidget* parent) : QSlider (parent) 8 | { 9 | setTracking (false); 10 | } 11 | 12 | void CSlider::mousePressEvent (QMouseEvent* event) 13 | { 14 | QSlider::mousePressEvent (event); 15 | m_mousePressed = true; 16 | // Very important because the slider can enter in an infinit loop. 17 | setRepeatAction (QAbstractSlider::SliderNoAction); 18 | } 19 | 20 | void CSlider::mouseReleaseEvent (QMouseEvent* event) 21 | { 22 | QSlider::mouseReleaseEvent (event); 23 | m_mousePressed = false; 24 | // Very important because the slider can enter in an infinit loop. 25 | setRepeatAction (QAbstractSlider::SliderNoAction); 26 | } 27 | 28 | void CSlider::jumpToMousePosition (int action) 29 | { 30 | if (!signalsBlocked () && (action == QAbstractSlider::SliderPageStepAdd || action == QAbstractSlider::SliderPageStepSub)) 31 | { 32 | QStyleOptionSlider opt; 33 | opt.initFrom (this); 34 | QRect sr = style ()->subControlRect (QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this); 35 | float normalizedPosition; 36 | QPoint localPos = mapFromGlobal (QCursor::pos ()); 37 | if (orientation () == Qt::Vertical) 38 | { 39 | float halfHandleHeight = (0.5f * sr.height ()) + 0.5f; 40 | int height = this->height (); 41 | int adaptedPosY = height - localPos.y (); 42 | if (adaptedPosY < halfHandleHeight) 43 | { 44 | adaptedPosY = halfHandleHeight; 45 | } 46 | 47 | if (adaptedPosY > height - halfHandleHeight ) 48 | { 49 | adaptedPosY = height - halfHandleHeight; 50 | } 51 | 52 | float newHeight = (height - halfHandleHeight) - halfHandleHeight; 53 | normalizedPosition = (adaptedPosY - halfHandleHeight) / newHeight; 54 | } 55 | else 56 | { 57 | float halfHandleWidth = (0.5f * sr.width ()) + 0.5f; 58 | int adaptedPosX = localPos.x (); 59 | if (adaptedPosX < halfHandleWidth) 60 | { 61 | adaptedPosX = halfHandleWidth; 62 | } 63 | 64 | int width = this->width (); 65 | if (adaptedPosX > width - halfHandleWidth) 66 | { 67 | adaptedPosX = width - halfHandleWidth; 68 | } 69 | 70 | float newWidth = (width - halfHandleWidth) - halfHandleWidth; 71 | normalizedPosition = (adaptedPosX - halfHandleWidth) / newWidth; 72 | } 73 | 74 | int newVal = minimum () + ((maximum () - minimum ()) * normalizedPosition); 75 | if (invertedAppearance ()) 76 | { 77 | newVal = maximum () - newVal; 78 | } 79 | 80 | setValue (newVal); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /upnp/devicepixmap.cpp: -------------------------------------------------------------------------------- 1 | #include "devicepixmap.hpp" 2 | 3 | START_DEFINE_UPNP_NAMESPACE 4 | 5 | /*! \brief Internal structure of CDevicePixmap. */ 6 | struct SDevicePixmapData : public QSharedData 7 | { 8 | SDevicePixmapData () {} 9 | SDevicePixmapData (SDevicePixmapData const & other); 10 | 11 | QString m_url; //!< url of the pixmap. 12 | QString m_mimeType; //!< The mime type. 13 | int m_width = 0, m_height = 0, m_depth = 0; //!< The width, height and depth. 14 | }; 15 | 16 | SDevicePixmapData::SDevicePixmapData (SDevicePixmapData const & other) : QSharedData (other), 17 | m_url (other.m_url), m_mimeType (other.m_mimeType), m_width (other.m_width), m_height (other.m_height), 18 | m_depth (other.m_depth) 19 | { 20 | } 21 | 22 | }//Namespace 23 | 24 | USING_UPNP_NAMESPACE 25 | 26 | CDevicePixmap::CDevicePixmap () : m_d (new SDevicePixmapData) 27 | { 28 | } 29 | 30 | CDevicePixmap::CDevicePixmap (CDevicePixmap const & other) : m_d (other.m_d) 31 | { 32 | } 33 | 34 | CDevicePixmap::~CDevicePixmap () 35 | { 36 | } 37 | 38 | CDevicePixmap& CDevicePixmap::operator = (CDevicePixmap const & other) 39 | { 40 | if (this != &other) 41 | { 42 | m_d.operator = (other.m_d); 43 | } 44 | 45 | return *this; 46 | } 47 | 48 | void CDevicePixmap::setUrl (QString const & url) 49 | { 50 | m_d->m_url = url; 51 | } 52 | 53 | void CDevicePixmap::setMimeType (QString mimeType) 54 | { 55 | mimeType.remove ("image/"); 56 | mimeType = mimeType.toLower (); 57 | m_d->m_mimeType = mimeType; 58 | } 59 | 60 | void CDevicePixmap::setWidth (int w) 61 | { 62 | m_d->m_width = w; 63 | } 64 | 65 | void CDevicePixmap::setHeight ( int h) 66 | { 67 | m_d->m_height = h; 68 | } 69 | 70 | void CDevicePixmap::setDepth (int d) 71 | { 72 | m_d->m_depth = d; 73 | } 74 | 75 | QString const & CDevicePixmap::url () const 76 | { 77 | return m_d->m_url; 78 | } 79 | 80 | QString const & CDevicePixmap::mimeType () const 81 | { 82 | return m_d->m_mimeType; 83 | } 84 | 85 | int CDevicePixmap::width () const 86 | { 87 | return m_d->m_width; 88 | } 89 | 90 | int CDevicePixmap::height () const 91 | { 92 | return m_d->m_height; 93 | } 94 | 95 | int CDevicePixmap::depth () const 96 | { 97 | return m_d->m_depth; 98 | } 99 | 100 | int CDevicePixmap::preferedCriteria () const 101 | { 102 | return preferedCriteria (width (), height (), depth ()); 103 | } 104 | 105 | bool CDevicePixmap::hasMimeType (char const * mimeType) const 106 | { 107 | QString desc (mimeType); 108 | desc = desc.toLower (); 109 | return desc == m_d->m_mimeType; 110 | } 111 | 112 | -------------------------------------------------------------------------------- /upnp/initialdiscovery.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INITIAL_DISCOVERY_HPP 2 | #define INITIAL_DISCOVERY_HPP 1 3 | 4 | #include "using_upnp_namespace.hpp" 5 | #include 6 | #include 7 | 8 | START_DEFINE_UPNP_NAMESPACE 9 | 10 | class CUpnpSocket; 11 | 12 | /*! \brief Provides methods to discover the UPnP devices. */ 13 | class CInitialDiscovery : public QEventLoop 14 | { 15 | Q_OBJECT 16 | 17 | public : 18 | /*! Constructor. 19 | * \param socket: The socket to send discovery messages. 20 | * \param hostAddress: The ip address. 21 | * \param port: The port generally 1900. 22 | */ 23 | CInitialDiscovery (CUpnpSocket* socket, QHostAddress const & hostAddress, quint16 port); 24 | 25 | /*! Launchs discovery. 26 | * \param changeMX: True means the MX of the discovery message is changed at each sended message. 27 | * \param uuid: The destination uuid. 28 | */ 29 | bool discover (bool changeMX = false, char const * uuid = nullptr); 30 | 31 | /*! Sets the discovery pause in milliseconds. */ 32 | void setDiscoveryPause (int pause) { m_discoveryPause = pause; } 33 | 34 | /*! Restore the MX value at the default value (3s). */ 35 | void restoreDefaultMX () { m_mx = 3; } 36 | 37 | /*! Sets the socket. */ 38 | inline void setSocket (CUpnpSocket* socket); 39 | 40 | /*! Sets the ip address. */ 41 | inline void setHostAddress (QHostAddress const & hostAddress); 42 | 43 | /*! Sets the port. */ 44 | inline void setPort (quint16 port); 45 | 46 | /*! Returns the port. */ 47 | inline quint16 port () const; 48 | 49 | /*! Returns the current MX value. */ 50 | inline quint16 mx () const; 51 | 52 | protected: 53 | /*! Wrapper for timer event. */ 54 | virtual void timerEvent (QTimerEvent* event); 55 | 56 | protected : 57 | CUpnpSocket* m_socket; //!< The socket. 58 | QHostAddress m_hostAddress; //!< ip address. 59 | quint16 m_port = 0; //!< The port. 60 | qint16 m_mx = 5; //!< The current MX value. 61 | int m_discoveryPause = 0; //!< Defualt discovery pause between each sent message (500ms). 62 | int m_idTimer; // 6 | 7 | START_DEFINE_UPNP_NAMESPACE 8 | 9 | struct SActionInfoData; 10 | 11 | /*! \brief Holds information about send and retrieve data for an action. 12 | * 13 | * It contains some data used by the action caller to invoke the action and the response. 14 | * 15 | * \remark Use implicit Sharing QT technology. 16 | * 17 | */ 18 | class UPNP_API CActionInfo 19 | { 20 | public : 21 | /*! Default constructor. */ 22 | CActionInfo (); 23 | 24 | /*! Copy constructor. */ 25 | CActionInfo (CActionInfo const & other); 26 | 27 | /*! Destructor. */ 28 | ~CActionInfo (); 29 | 30 | /*! Copy operator. */ 31 | CActionInfo& operator = (CActionInfo const & other); 32 | 33 | /*! Prepares the data for the action caller. 34 | * \param deviceUUID: The device uuid. 35 | * \param serviceID: The service ID that contains action. 36 | * \param action: The action name. 37 | */ 38 | void startMessage (QString const & deviceUUID, QString const & serviceID, QString const & action); 39 | 40 | /*! End the message creation. */ 41 | void endMessage (); 42 | 43 | /*! Add an argument. 44 | * \param name: The argument name. 45 | * \param value: The parameter value. 46 | */ 47 | void addArgument (QString const & name, QString const & value); 48 | 49 | /*! Returns true if the action is sent without network error. 50 | * May be, an UPnP error can be generated by the device. 51 | */ 52 | bool succeeded () const; 53 | 54 | /*! Returns the device uuid. */ 55 | QString const & deviceUUID () const; 56 | 57 | /*! Returns the service identifier. */ 58 | QString const & serviceID () const; 59 | 60 | /*! Returns the action name. */ 61 | QString const & actionName () const; 62 | 63 | /*! Returns the actual message to sent. */ 64 | QString const & message () const; 65 | 66 | /*! Returns the response of the QNetworkmanager. */ 67 | QByteArray const & response () const; 68 | 69 | /*! Sets the success state of the QNetworkManager response. */ 70 | void setSucceeded (bool success); 71 | 72 | /*! Sets the device uuid. */ 73 | void setDeviceUUID (QString const & uuid); 74 | 75 | /*! Sets the service identifier. */ 76 | void setserviceID (QString const & type); 77 | 78 | /*! Sets the action name. */ 79 | void setActionName (QString const & name); 80 | 81 | /*! Sets the message. */ 82 | void setMessage (QString const & message); 83 | 84 | /*! Sets the response. */ 85 | void setResponse (QByteArray const & response); 86 | 87 | private : 88 | QSharedDataPointer m_d; //!< Shared data pointer. 89 | }; 90 | 91 | } // End namespace 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /aivctrl/aivctrl.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2017-09-22T17:51:22 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui network xml 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = aivctrl 12 | TEMPLATE = app 13 | 14 | QMAKE_CXXFLAGS += -std=c++11 15 | 16 | SOURCES += main.cpp\ 17 | mainwindow.cpp \ 18 | systemevents.cpp \ 19 | icons.cpp \ 20 | mainwindowhelper.cpp \ 21 | popupmenus.cpp \ 22 | buttonslots.cpp \ 23 | listwidgetslots.cpp \ 24 | variousslots.cpp \ 25 | controlpointslots.cpp \ 26 | helper.cpp \ 27 | sliderslots.cpp \ 28 | session.cpp \ 29 | playlist.cpp \ 30 | playlistchoice.cpp \ 31 | xmlhplaylist.cpp \ 32 | serverscanner.cpp \ 33 | about.cpp \ 34 | language.cpp \ 35 | settings.cpp \ 36 | aivwidgets/contentdirectorybrowser.cpp \ 37 | aivwidgets/cover.cpp \ 38 | aivwidgets/devicebrowser.cpp \ 39 | aivwidgets/folderbrowser.cpp \ 40 | aivwidgets/listwidgetbase.cpp \ 41 | aivwidgets/mydevicebrowser.cpp \ 42 | aivwidgets/networkprogress.cpp \ 43 | aivwidgets/playlistbrowser.cpp \ 44 | aivwidgets/position.cpp \ 45 | aivwidgets/slider.cpp \ 46 | aivwidgets/textmetadata.cpp \ 47 | aivwidgets/widgethelper.cpp \ 48 | aivwidgets/cloudbrowser.cpp 49 | 50 | HEADERS += mainwindow.hpp \ 51 | helper.hpp \ 52 | session.hpp \ 53 | playlist.hpp \ 54 | playlistchoice.hpp \ 55 | xmlhplaylist.hpp \ 56 | serverscanner.hpp \ 57 | about.hpp \ 58 | language.hpp \ 59 | settings.hpp \ 60 | aivwidgets/contentdirectorybrowser.hpp \ 61 | aivwidgets/cover.hpp \ 62 | aivwidgets/devicebrowser.hpp \ 63 | aivwidgets/folderbrowser.hpp \ 64 | aivwidgets/listwidgetbase.hpp \ 65 | aivwidgets/mydevicebrowser.hpp \ 66 | aivwidgets/networkprogress.hpp \ 67 | aivwidgets/playlistbrowser.hpp \ 68 | aivwidgets/position.hpp \ 69 | aivwidgets/slider.hpp \ 70 | aivwidgets/textmetadata.hpp \ 71 | aivwidgets/widgethelper.hpp \ 72 | aivwidgets/cloudbrowser.hpp 73 | 74 | FORMS += mainwindow.ui \ 75 | playlistchoice.ui \ 76 | about.ui \ 77 | language.ui \ 78 | settings.ui 79 | 80 | RESOURCES += \ 81 | aivctrl.qrc 82 | 83 | DISTFILES += \ 84 | aivctrl.rc 85 | 86 | RC_FILE += \ 87 | aivctrl.rc 88 | 89 | win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../upnp/release/ -lqtupnp 90 | else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../upnp/debug/ -lqtupnp 91 | 92 | unix { 93 | LIBS += $$OUT_PWD/../upnp/libqtupnp.a 94 | PRE_TARGETDEPS += $$OUT_PWD/../upnp/libqtupnp.a 95 | } 96 | 97 | macx:ICON=$$PWD/icons/aivctrl64.icns 98 | 99 | 100 | -------------------------------------------------------------------------------- /googledrive/googledrive.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2017-12-12T15:17:56 4 | # 5 | #------------------------------------------------- 6 | 7 | QT = gui network xml 8 | 9 | TARGET = googledrive 10 | TEMPLATE = lib 11 | 12 | DEFINES += GOOGLEDRIVE_LIBRARY 13 | 14 | # The following define makes your compiler emit warnings if you use 15 | # any feature of Qt which as been marked as deprecated (the exact warnings 16 | # depend on your compiler). Please consult the documentation of the 17 | # deprecated API in order to know how to port your code away from it. 18 | DEFINES += QT_DEPRECATED_WARNINGS 19 | 20 | # You can also make your code fail to compile if you use deprecated APIs. 21 | # In order to do so, uncomment the following line. 22 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 23 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 24 | 25 | SOURCES += pluginobject.cpp \ 26 | browse.cpp 27 | 28 | HEADERS += pluginobject.hpp\ 29 | googledrive_global.hpp 30 | 31 | unix { 32 | target.path = /usr/lib 33 | INSTALLS += target 34 | } 35 | 36 | win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../upnp/release/ -lqtupnp 37 | else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../upnp/debug/ -lqtupnp 38 | 39 | unix { 40 | LIBS += $$OUT_PWD/../upnp/libqtupnp.a 41 | PRE_TARGETDEPS += $$OUT_PWD/../upnp/libqtupnp.a 42 | } 43 | 44 | # Copy files needed for plugin (e.g. googledrive.ids, googledrive.png, googledrive.dll) 45 | # For this dep.cmd is launched after build. 46 | win32 { 47 | CONFIG(release, debug|release): DESTDIR = $$OUT_PWD/../aivctrl/release/plugins/ 48 | CONFIG(debug, debug|release): DESTDIR = $$OUT_PWD/../aivctrl/debug/plugins/ 49 | PLUGINDESTDIR=$$replace(DESTDIR, /, \\) 50 | PLUGINDIR=$$replace(PWD, /, \\) 51 | QMAKE_POST_LINK =$$PLUGINDIR\dep.cmd $$PLUGINDIR $$PLUGINDESTDIR 52 | } 53 | 54 | # Copy files needed for plugin (e.g. googledrive.ids, googledrive.png, googledrive.so) 55 | # For this dep.sh is launched after build. 56 | unix { 57 | CONFIG(release, release): DESTDIR = $$OUT_PWD/../aivctrl/plugins/ 58 | CONFIG(debug, debug): DESTDIR = $$OUT_PWD/../aivctrl/plugins/ 59 | PLUGINDESTDIR=$$DESTDIR 60 | PLUGINDIR=$$PWD 61 | QMAKE_POST_LINK = $$_PRO_FILE_PWD_/dep.sh $$PLUGINDIR $$PLUGINDESTDIR 62 | } 63 | 64 | # Copy files needed for plugin (e.g. googledrive.ids, googledrive.png, googledrive.dylib) 65 | # For this depmac.sh is launched after build. 66 | macx { 67 | CONFIG(release, release): DESTDIR = $$OUT_PWD/../aivctrl/plugins/ 68 | CONFIG(debug, debug): DESTDIR = $$OUT_PWD/../aivctrl/plugins/ 69 | PLUGINDESTDIR=$$DESTDIR 70 | PLUGINDIR=$$PWD 71 | QMAKE_POST_LINK = $$_PRO_FILE_PWD_/depmac.sh $$PLUGINDIR $$PLUGINDESTDIR 72 | } 73 | 74 | DISTFILES += \ 75 | dep.sh \ 76 | depmac.sh \ 77 | googledrive.ids \ 78 | googledrive.png \ 79 | dep.cmd 80 | -------------------------------------------------------------------------------- /upnp/aes256.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file defined an EXAMPLE to create hash key and iv for AES 256 encryption. 3 | This keys must be as invisible as possible because they are used to encrypt and decrypt 4 | the tokens requisite by the authentification on the remote servers. 5 | E.g. for google drive, client_id, client_secret, access_token and refresh_token are encrypted 6 | to hide these values. They are decrypted only when they are used. 7 | 8 | The method below is an example to produce AES 256 keys. 9 | You can create your own method. Just an array of char (one for key one for iv) is important. 10 | 11 | The method below use 2 strings of 32 charaters. 12 | 13 | AES 256 Hash key. Each character is converted like: 14 | 'ascii' -> hexadecimal value. 15 | '0' -> 0x30 16 | '5' -> 0x35 17 | ... 18 | 'c' -> 0x63 19 | ... 20 | QByteArray key("35314c8e64084db3f4bd6cbf616d4fee"); 21 | char key[] = { 0x30, 0x35, 0x33, 0x31, 0x34, 0x63, 0x38, 0x65, 22 | 0x36, 0x34, 0x30, 0x38, 0x34, 0x64, 0x62, 0x33, 23 | 0x66, 0x34, 0x62, 0x64, 0x36, 0x63, 0x62, 0x66, 24 | 0x36, 0x31, 0x36, 0x64, 0x34, 0x66, 0x65, 0x65, 0x00 }; 25 | 26 | AES 256 IV. Same method. 27 | QByteArray iv ("e5316ab7 f7994bd2 a2422fab b31bb3d1"); 28 | char iv[] = { 0x65, 0x35, 0x33, 0x31, 0x36, 0x61, 0x62, 0x37, 29 | 0x66, 0x35, 0x33, 0x31, 0x36, 0x61, 0x62, 0x37, 30 | 0x61, 0x32, 0x34, 0x32, 0x32, 0x66, 0x61, 0x62, 31 | 0x62, 0x33, 0x33, 0x62, 0x62, 0x33, 0x64, 0x31, 0x00 }; 32 | 33 | ukey contains the hash key and iv used by AES 256 encryption. 34 | key[0], key[1], ... , key[7], IV[7] -> quint64 35 | key[0], key[8], ... , key[15], IV[15] -> quint64 36 | .... 37 | key[24], key[25], ... , key[31], IV[31] -> quint64 38 | 39 | Apply same metho to iv. 40 | */ 41 | 42 | // This part is to not have visible following characters in the exeucutable. 43 | quint64 ukey[] = { 0x3035333134633865ul, 44 | 0x3634303834646233ul, 45 | 0x6634626436636266ul, 46 | 0x3631366434666565ul, 47 | }; 48 | 49 | quint64 uiv[] = { 0x6535333136616237ul, 50 | 0x6635333136616237ul, 51 | 0x6132343232666162ul, 52 | 0x6233336262336431ul, 53 | }; 54 | 55 | // Compute key and iv used by COAuth2::characters. The quint64 must be converted to char. 56 | // AIVCtrl use a similar but more complex algorithm to create key and iv. 57 | // The following characters exists for a very short time in memory. 58 | char key[33], iv[33]; 59 | for (unsigned i = 0, k = 0; i < sizeof (ukey) / sizeof (quint64); ++i) 60 | { 61 | for (unsigned j = 0; j < 8; ++j) 62 | { 63 | int shift = 8 * j; 64 | key[k] = static_cast((ukey[i] >> shift) & 0xff); 65 | iv[k] = static_cast((uiv[i] >> shift) & 0xff); 66 | ++k; 67 | } 68 | } 69 | 70 | key[32] = iv[32] = '\0'; 71 | 72 | 73 | -------------------------------------------------------------------------------- /aivctrl/install/win32/build-Qt580-Mingw53.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem Qt installation folder where find bin (Change to your Qt folder). 4 | set QTDIR=C:\Qt\Qt5.8.0\5.8\mingw53_32 5 | 6 | rem The QtUPnP folder (Change to your QtUPnP folder). 7 | set DEVELDIR=C:\Users\%USERNAME%\Documents\Development 8 | 9 | rem All files and folders for InstallShield or to launch AIVCtrl 10 | set TARGET=build 11 | 12 | rem Product name. 13 | set PRODUCT=aivctrl 14 | 15 | rem Compilation results. 16 | set BINARIES=%DEVELDIR%\build-aivctrl-Desktop_Qt_5_8_0_MinGW_32bit-Release 17 | 18 | if not exist %TARGET% goto nodel 19 | echo ************* Remove old folder 20 | echo %TARGET% 21 | rmdir %TARGET% /S /Q 22 | 23 | :nodel 24 | 25 | md %TARGET% 26 | 27 | echo ************* Binary files 28 | copy %BINARIES%\%PRODUCT%\release\%PRODUCT%.exe %TARGET% 29 | copy %BINARIES%\upnp\release\QtUPnP.dll %TARGET% 30 | xcopy ..\..\icons\%PRODUCT%48.png %TARGET% 31 | 32 | echo ************* Plugins files 33 | xcopy %BINARIES%\%PRODUCT%\release\plugins\*.* %TARGET%\plugins\*.* 34 | 35 | echo ************* Translation 36 | xcopy ..\..\languages\aivctrl_??.qm "%TARGET%\languages" /Y /I 37 | xcopy ..\..\languages\*.png "%TARGET%\languages" /Y /I 38 | 39 | echo ************* Qt Images plugins 40 | md "%TARGET%\imageformats" 41 | copy "%QTDIR%\plugins\imageformats\qgif.dll" "%TARGET%\imageformats" 42 | copy "%QTDIR%\plugins\imageformats\qicns.dll" "%TARGET%\imageformats" 43 | copy "%QTDIR%\plugins\imageformats\qico.dll" "%TARGET%\imageformats" 44 | copy "%QTDIR%\plugins\imageformats\qjpeg.dll" "%TARGET%\imageformats" 45 | copy "%QTDIR%\plugins\imageformats\qsvg.dll" "%TARGET%\imageformats" 46 | copy "%QTDIR%\plugins\imageformats\qtga.dll" "%TARGET%\imageformats" 47 | copy "%QTDIR%\plugins\imageformats\qtiff.dll" "%TARGET%\imageformats" 48 | copy "%QTDIR%\plugins\imageformats\qwbmp.dll" "%TARGET%\imageformats" 49 | copy "%QTDIR%\plugins\imageformats\qwebp.dll" "%TARGET%\imageformats" 50 | 51 | echo ************* Qt Bearer plugins 52 | md "%TARGET%\bearer" 53 | copy "%QTDIR%\plugins\bearer\qgenericbearer.dll" "%TARGET%\bearer" 54 | copy "%QTDIR%\plugins\bearer\qnativewifibearer.dll" "%TARGET%\bearer" 55 | 56 | echo ************* Qt platforms 57 | md "%TARGET%\platforms" 58 | copy "%QTDIR%\plugins\platforms\qminimal.dll" "%TARGET%\platforms" 59 | copy "%QTDIR%\plugins\platforms\qoffscreen.dll" "%TARGET%\platforms" 60 | copy "%QTDIR%\plugins\platforms\qwindows.dll" "%TARGET%\platforms" 61 | 62 | echo ************* C++ mingw files 63 | copy "%QTDIR%\bin\libgcc_s_dw2-1.dll" %TARGET% 64 | copy "%QTDIR%\bin\libstdc++-6.dll" %TARGET% 65 | copy "%QTDIR%\bin\libwinpthread-1.dll" %TARGET% 66 | 67 | echo ************* Qt binary files 68 | copy %QTDIR%\bin\qt5core.dll %TARGET% 69 | copy %QTDIR%\bin\qt5gui.dll %TARGET% 70 | copy %QTDIR%\bin\qt5xml.dll %TARGET% 71 | copy %QTDIR%\bin\qt5network.dll %TARGET% 72 | copy %QTDIR%\bin\qt5widgets.dll %TARGET% 73 | copy %QTDIR%\bin\linguist.exe %TARGET% 74 | pause 75 | 76 | :end 77 | 78 | -------------------------------------------------------------------------------- /aivctrl/serverscanner.hpp: -------------------------------------------------------------------------------- 1 | #ifndef SERVERSCANNER_HPP 2 | #define SERVERSCANNER_HPP 3 | 4 | #include "../upnp/didlitem.hpp" 5 | #include 6 | #include 7 | #include 8 | 9 | namespace QtUPnP { 10 | class CControlPoint; 11 | } 12 | 13 | class QProgressDialog; 14 | 15 | /*! This class provides functionalities to browse a server. It is used to checked playlist items. 16 | * The class scan a server to retreave an item from a title. 17 | * A set of optimizations is use to speedup the search. 18 | */ 19 | class CServerScanner 20 | { 21 | public: 22 | /*! Items already found. */ 23 | typedef QHash TDidlItem; 24 | 25 | /*! Container already scanned. */ 26 | struct SContainer 27 | { 28 | SContainer () {} 29 | SContainer (QString const & id, QString const & title) : m_id (id), m_title (title) {} 30 | SContainer (SContainer const & other) : m_id (other.m_id), m_title (other.m_title) {} 31 | 32 | SContainer& operator = (SContainer const & other) 33 | { 34 | m_id = other.m_id; 35 | m_title = other.m_title; 36 | return *this; 37 | } 38 | 39 | bool operator == (SContainer const & other) const 40 | { 41 | return m_id == other.m_id; 42 | } 43 | 44 | bool operator == (QString const & id) const 45 | { 46 | return m_id == id; 47 | } 48 | 49 | QString m_id, m_title; 50 | }; 51 | 52 | /*! Current queue containers already scanned. */ 53 | typedef QQueue TContainers; 54 | 55 | /*! Actual server scanned. */ 56 | struct SServerData 57 | { 58 | SServerData () {} 59 | SServerData (SServerData const & other) : m_titles (other.m_titles), m_containers (other.m_containers) {} 60 | 61 | SServerData& operator = (SServerData const & other) 62 | { 63 | m_titles = other.m_titles; 64 | m_containers = other.m_containers; 65 | return *this; 66 | } 67 | 68 | TDidlItem m_titles; 69 | TContainers m_containers; 70 | }; 71 | 72 | /*! Constructor. */ 73 | CServerScanner (QtUPnP::CControlPoint* cp, QtUPnP::CDidlItem::EType type, QProgressDialog* progress); 74 | 75 | /*! Returns the contril point. */ 76 | QtUPnP::CControlPoint* controlPoint () { return m_cp; } 77 | 78 | /*! Scans the server. */ 79 | QtUPnP::CDidlItem scan (QString const & uuid, QString const & title); 80 | 81 | /*! Invokes browse action. */ 82 | QtUPnP::CDidlItem browse (QString const & uuid, QString const & title); 83 | 84 | void setProgressLabel (QString const & title); 85 | 86 | private : 87 | QtUPnP::CControlPoint* m_cp = nullptr; 88 | QMap m_servers; 89 | QtUPnP::CDidlItem::EType m_type = QtUPnP::CDidlItem::Unknown; 90 | QSet m_containerTypes; 91 | QProgressDialog* m_progress = nullptr; 92 | int m_currentProgressValue = 0; 93 | int m_progressValue = 0; 94 | int const m_progressTitleLength = 30; 95 | int m_progressInc = 1; 96 | }; 97 | 98 | #endif // SERVERSCANNER_HPP 99 | -------------------------------------------------------------------------------- /aivctrl/language.cpp: -------------------------------------------------------------------------------- 1 | #include "language.hpp" 2 | #include "helper.hpp" 3 | #include "ui_language.h" 4 | #include "aivwidgets/widgethelper.hpp" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | CLanguage::CLanguage (QWidget* parent) : QDialog (parent), ui (new Ui::CLanguage) 12 | { 13 | ui->setupUi (this); 14 | removeWindowContextHelpButton (this); 15 | setTransparentBackGround (ui->m_languages); 16 | ui->m_ok->setEnabled (false); 17 | 18 | QString qmPath = appFileDir (); 19 | QDir qmDir (qmPath); 20 | qmDir.cd ("languages"); 21 | 22 | tr ("French"); 23 | TLanguage language = { tr ("English"), "en", QString () }; 24 | m_availableLanguages << language; 25 | 26 | QStringList qmFiles = qmDir.entryList (QStringList ("*.qm")); 27 | foreach (QString const & qmFile, qmFiles) 28 | { 29 | int languageIndex = qmFile.indexOf ('_'); 30 | int languageSuffix = qmFile.indexOf ('.', languageIndex); 31 | QString shortName = qmFile.mid (languageIndex + 1, languageSuffix - languageIndex - 1); 32 | QLocale locale (shortName); 33 | QString longName = QLocale::languageToString (locale.language ()); 34 | TLanguage language = { qApp->translate ("CLanguage", longName.toLatin1 ().constData ()), shortName, qmFile }; 35 | m_availableLanguages << language; 36 | } 37 | 38 | qSort (m_availableLanguages.begin (), m_availableLanguages.end (), [] (TLanguage const & l1, TLanguage const & l2) -> bool { return l1[tyLongName] < l2[tyLongName]; }); 39 | 40 | for (TLanguage const & availableLanguage : m_availableLanguages) 41 | { 42 | QListWidgetItem* item = new QListWidgetItem (ui->m_languages); 43 | item->setText (availableLanguage[tyLongName]); 44 | QString iconName (qmDir.absoluteFilePath (availableLanguage[tyShortName] + ".png")); 45 | item->setIcon (QIcon (iconName)); 46 | } 47 | } 48 | 49 | CLanguage::~CLanguage () 50 | { 51 | delete ui; 52 | } 53 | 54 | QString CLanguage::qmFileSelected () const 55 | { 56 | return m_slectedLanguageIndex > 0 ? m_availableLanguages[m_slectedLanguageIndex][tyQmFile] : QString (); 57 | } 58 | 59 | QString CLanguage::shortNameSelected () const 60 | { 61 | return m_availableLanguages[m_slectedLanguageIndex][tyShortName]; 62 | } 63 | 64 | void CLanguage::on_m_languages_itemDoubleClicked (QListWidgetItem* item) 65 | { 66 | m_slectedLanguageIndex = ui->m_languages->row (item); 67 | accept (); 68 | } 69 | 70 | void CLanguage::on_m_languages_itemSelectionChanged () 71 | { 72 | QList items = ui->m_languages->selectedItems (); 73 | ui->m_ok->setEnabled (!items.isEmpty ()); 74 | } 75 | 76 | void CLanguage::on_m_ok_clicked () 77 | { 78 | QList items = ui->m_languages->selectedItems (); 79 | m_slectedLanguageIndex = items.isEmpty () ? -1 : ui->m_languages->row (items.first ()); 80 | accept (); 81 | } 82 | 83 | void CLanguage::on_m_cancel_clicked () 84 | { 85 | reject (); 86 | } 87 | -------------------------------------------------------------------------------- /upnp/mediainfo.hpp: -------------------------------------------------------------------------------- 1 | #ifndef MEDIA_INFO_HPP 2 | #define MEDIA_INFO_HPP 3 | 4 | #include "didlitem.hpp" 5 | #include 6 | 7 | START_DEFINE_UPNP_NAMESPACE 8 | 9 | struct SMediaInfoData; 10 | 11 | /*! \brief The CMediaInfo class holds information about GetMediaInfo action. 12 | * 13 | * See http://upnp.org/specs/av/UPnP-av-AVTransport-Service.pdf. 14 | * 15 | * \remark Use implicit Sharing QT technology. 16 | */ 17 | class UPNP_API CMediaInfo 18 | { 19 | public: 20 | /*! Default constructor. */ 21 | CMediaInfo (); 22 | 23 | /*! Copy constructor. */ 24 | CMediaInfo (const CMediaInfo &); 25 | 26 | /*! Equal operator. */ 27 | CMediaInfo& operator = (const CMediaInfo &); 28 | 29 | /*! Destructor. */ 30 | ~CMediaInfo (); 31 | 32 | /*! Sets the track number.*/ 33 | void setNrTracks (unsigned nrTracks); 34 | 35 | /*! Sets the media duration. */ 36 | void setMediaDuration (QString const & duration); 37 | 38 | /*! Sets current uri. */ 39 | void setCurrentURI (QString const & uri); 40 | 41 | /*! Sets current uri metadata. */ 42 | void setCurrentURIMetaData (QString const & metadata); 43 | 44 | /*! Sets next uri. */ 45 | void setNextURI (QString const & uri); 46 | 47 | /*! Sets next uri metadata. */ 48 | void setNextURIMetaData (QString const & metadata); 49 | 50 | /*! Sets the play medium. */ 51 | void setPlayMedium (QString const & medium); 52 | 53 | /*! Sets the record medium. */ 54 | void setRecordMedium (QString const & medium); 55 | 56 | /*! Sets the write status. */ 57 | void setWriteStatus (QString const & status); 58 | 59 | /*! Returns the track number.*/ 60 | unsigned nrTracks () const; 61 | 62 | /*! Returns the media duration. */ 63 | QString const & mediaDuration () const; 64 | 65 | /*! Returns current uri. */ 66 | QString const & currentURI () const; 67 | 68 | /*! Returns current uri metadata. */ 69 | QString const & currentURIMetaData () const; 70 | 71 | /*! Returns next uri. */ 72 | QString const & nextURI () const; 73 | 74 | /*! Returns next uri metadata. */ 75 | QString const & nextURIMetaData () const; 76 | 77 | /*! Returns the play medium. */ 78 | QString const & playMedium () const; 79 | 80 | /*! Returns the record medium. */ 81 | QString const & recordMedium () const; 82 | 83 | /*! Returns the write status. */ 84 | QString const & writeStatus () const; 85 | 86 | /*! Converts the current uri metadata in a CDidlItem. */ 87 | CDidlItem currentURIDidlItem () const; 88 | 89 | /*! Converts the next uri metadata in a CDidlItem. */ 90 | CDidlItem nextURIDidlItem () const; 91 | 92 | private : 93 | /*! Converts metadata in a CDidlItem. */ 94 | static CDidlItem didlItem (QString const & metaData); 95 | 96 | private: 97 | QSharedDataPointer m_d; //!< Shared data pointer. 98 | }; 99 | 100 | } //Namespace 101 | 102 | #endif // MEDIA_INFO_HPP 103 | -------------------------------------------------------------------------------- /upnp/connectionmanager.cpp: -------------------------------------------------------------------------------- 1 | #include "connectionmanager.hpp" 2 | #include "controlpoint.hpp" 3 | #include "actioninfo.hpp" 4 | 5 | USING_UPNP_NAMESPACE 6 | 7 | QStringList CConnectionManager::getCurrentConnectionIDs (QString const & deviceUUID) 8 | { 9 | Q_ASSERT (m_cp != nullptr); 10 | QStringList ids; 11 | QList args; 12 | args << CControlPoint::TArgValue ("ConnectionIDs", QString ()); 13 | CActionInfo actionInfo = m_cp->invokeAction (deviceUUID, "GetCurrentConnectionIDs", args); 14 | if (actionInfo.succeeded ()) 15 | { 16 | ids = fromCVS (args.last ().second); 17 | if (!ids.isEmpty () && ids.first () != "0") 18 | { 19 | CDevice& device = m_cp->device (deviceUUID); 20 | device.setConnectionID (ids.first ().toUInt ()); 21 | } 22 | } 23 | 24 | return ids; 25 | } 26 | 27 | QVector CConnectionManager::getProtocolInfos (QString const & deviceUUID) 28 | { 29 | Q_ASSERT (m_cp != nullptr); 30 | QVector protocols (2); 31 | QList args; 32 | args.reserve (2); 33 | args << CControlPoint::TArgValue ("Source", QString ()); 34 | args << CControlPoint::TArgValue ("Sink", QString ()); 35 | CActionInfo actionInfo = m_cp->invokeAction (deviceUUID, "GetProtocolInfo", args); 36 | if (actionInfo.succeeded ()) 37 | { 38 | protocols[Source] = fromCVS (args[0].second); 39 | protocols[Sink] = fromCVS (args[1].second); 40 | } 41 | 42 | return protocols; 43 | } 44 | 45 | CConnectionInfo CConnectionManager::getCurrentConnectionInfo (QString const & deviceUUID) 46 | { 47 | Q_ASSERT (m_cp != nullptr); 48 | CConnectionInfo connectionInfo; 49 | CDevice const & device = m_cp->device (deviceUUID); 50 | 51 | QString id = QString::number (device.connectionID ()); 52 | QList args; 53 | args.reserve (8); 54 | args << CControlPoint::TArgValue ("ConnectionID", id); 55 | args << CControlPoint::TArgValue ("RcsID", QString ()); 56 | args << CControlPoint::TArgValue ("AVTransportID", QString ()); 57 | args << CControlPoint::TArgValue ("ProtocolInfo", QString ()); 58 | args << CControlPoint::TArgValue ("PeerConnectionManager", QString ()); 59 | args << CControlPoint::TArgValue ("PeerConnectionID", QString ()); 60 | args << CControlPoint::TArgValue ("Direction", QString ()); 61 | args << CControlPoint::TArgValue ("Status", QString ()); 62 | 63 | CActionInfo actionInfo = m_cp->invokeAction (deviceUUID, "GetCurrentConnectionInfo", args); 64 | if (actionInfo.succeeded ()) 65 | { 66 | connectionInfo.setRcsID (args[1].second.toInt ()); 67 | connectionInfo.setAVTransportID (args[2].second.toInt ()); 68 | connectionInfo.setProtocolInfo (args[3].second); 69 | connectionInfo.setPeerConnectionManager (args[4].second); 70 | connectionInfo.setPeerConnectionID (args[5].second.toInt ()); 71 | connectionInfo.setDirection (args[6].second); 72 | connectionInfo.setStatus (args[7].second); 73 | } 74 | 75 | return connectionInfo; 76 | } 77 | -------------------------------------------------------------------------------- /upnp/actionmanager.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ACTION_MANAGER_HPP 2 | #define ACTION_MANAGER_HPP 1 3 | 4 | #include "using_upnp_namespace.hpp" 5 | #include "upnp_global.hpp" 6 | #include 7 | #include 8 | 9 | START_DEFINE_UPNP_NAMESPACE 10 | 11 | class CActionInfo; 12 | 13 | /*! \brief Provides the mechanism to sent action to the device. 14 | * 15 | * The action message is sent using a QNetworkManager. 16 | */ 17 | class UPNP_API CActionManager : public QEventLoop 18 | { 19 | Q_OBJECT 20 | 21 | public : 22 | enum ETime { Timeout = 30000 }; //!< HTTP request timeout in ms (30s). 23 | 24 | /*! Default constructor. */ 25 | CActionManager (QObject* parent = nullptr); 26 | 27 | /*! Constructor with network access manager. 28 | * 29 | * The internal QNetworkAccessManager is not created. The object use naMgr. 30 | * It is sometimes useful because create and destroy the network access manager 31 | * consumes time. Use this contructor when you want call post function many times. 32 | */ 33 | CActionManager (QNetworkAccessManager* naMgr, QObject* parent = nullptr); 34 | 35 | /*! Destructor. */ 36 | ~CActionManager (); 37 | 38 | /*! Post an upnp action on the network. 39 | * \param device: The device uuid. 40 | * \param url: The destination url. 41 | * \param info: The class CActionInfo that contains the formatted message to sent end the response. 42 | * \param timeout: Maximum time for the responds. 43 | */ 44 | bool post (QString const & device, QUrl const & url, CActionInfo& info, 45 | int timeout = CActionManager::Timeout); 46 | 47 | /*! The time to execute the last action. */ 48 | static int lastElapsedTime () { return m_elapsedTime; } 49 | 50 | /*! The error generated by the last action. 51 | * A better way is to use the signal/slot mecanism to handle the error. See CControlPoint. 52 | */ 53 | static QString lastError () { return m_lastError; } 54 | 55 | protected: 56 | /*! This function is called in case of timeout. */ 57 | virtual void timerEvent (QTimerEvent*); 58 | 59 | private slots: 60 | /*! Slot call when the responds is finished. */ 61 | void finished (); 62 | 63 | /*! Slot for network error. 64 | * \param err: The QNetworkReply::NetworkError code. 65 | */ 66 | void error (QNetworkReply::NetworkError err); 67 | 68 | signals : 69 | /*! Network error. */ 70 | void networkError (QString const &, QNetworkReply::NetworkError, QString const &); 71 | 72 | private : 73 | int m_milliSeconds = Timeout; //!< Timeout in ms. 74 | QString m_device; //!< Device uuid. 75 | QNetworkReply::NetworkError m_error = QNetworkReply::NoError; //!< Network error. 76 | QNetworkAccessManager* m_naMgr = nullptr; //!< The current netword access manager. see CActionManager (QNetworkAccessManager* naMgr, QObject* parent). 77 | 78 | static int m_elapsedTime; //!< The time to execute the last action. 79 | static QString m_lastError; //!< The error generated by the last action. 80 | }; // CActionManager 81 | 82 | } // Namespace 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /aivctrl/playlistchoice.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | CPlaylistChoice 4 | 5 | 6 | 7 | 0 8 | 0 9 | 280 10 | 186 11 | 12 | 13 | 14 | Choose a playlist 15 | 16 | 17 | 18 | 2 19 | 20 | 21 | 2 22 | 23 | 24 | 2 25 | 26 | 27 | 2 28 | 29 | 30 | 2 31 | 32 | 33 | 34 | 35 | Playlist name 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 12 44 | 45 | 46 | 47 | Enter a playlist name 48 | 49 | 50 | false 51 | 52 | 53 | 54 | 55 | 56 | 57 | Qt::Horizontal 58 | 59 | 60 | 61 | 62 | 63 | 64 | Existing playlists 65 | 66 | 67 | QFrame::NoFrame 68 | 69 | 70 | true 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | Qt::Horizontal 80 | 81 | 82 | 83 | 40 84 | 20 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | Ok 93 | 94 | 95 | 96 | 97 | 98 | 99 | Cancel 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /upnp/status.hpp: -------------------------------------------------------------------------------- 1 | #ifndef STATUS_HPP 2 | #define STATUS_HPP 3 | 4 | #include "using_upnp_namespace.hpp" 5 | #include "upnp_global.hpp" 6 | 7 | START_DEFINE_UPNP_NAMESPACE 8 | 9 | /*! \brief Holds information to simulate a set of 32 bits. 10 | * 11 | * It exists to simulate 2 states: exist or not. 12 | */ 13 | class UPNP_API CStatus 14 | { 15 | public: 16 | /*! Default constructor. */ 17 | inline CStatus () {} 18 | 19 | /*! Constructs with a st value. */ 20 | inline CStatus (unsigned st); 21 | 22 | /*! Copy constructor. */ 23 | inline CStatus (CStatus const & other); 24 | 25 | /*! Equal operator. */ 26 | inline CStatus& operator = (CStatus const & other); 27 | 28 | /*! Equal operator. */ 29 | inline CStatus& operator = (unsigned st); 30 | 31 | /*! Equality operator. */ 32 | inline bool operator == (CStatus const & other) const; 33 | 34 | /*! Inequality operator. */ 35 | inline bool operator != (CStatus const & other) const; 36 | 37 | /*! Adds a set of bits. */ 38 | inline void addStatus (unsigned st); 39 | 40 | /*! Sets a set of bits. */ 41 | inline void setStatus (unsigned st); 42 | 43 | /*! Removes a set of bits. */ 44 | inline void remStatus (unsigned st); 45 | 46 | /*! Has a set of bits. */ 47 | inline bool hasStatus (unsigned st) const; 48 | 49 | /*! Return the set of bits. */ 50 | inline unsigned status () const; 51 | 52 | protected : 53 | unsigned m_status = 0; //!< The 32 bits value of status. 54 | }; 55 | 56 | CStatus::CStatus (unsigned st) : m_status (st) 57 | { 58 | } 59 | 60 | CStatus::CStatus (CStatus const & other) : m_status (other.m_status) 61 | { 62 | } 63 | 64 | CStatus& CStatus::operator = (CStatus const & other) 65 | { 66 | m_status = other.m_status; 67 | return *this; 68 | } 69 | 70 | CStatus& CStatus::operator = (unsigned st) 71 | { 72 | m_status = st; 73 | return *this; 74 | } 75 | 76 | void CStatus::addStatus (unsigned st) 77 | { 78 | m_status |= st; 79 | } 80 | 81 | void CStatus::setStatus (unsigned st) 82 | { 83 | m_status = st; 84 | } 85 | 86 | void CStatus::remStatus (unsigned st) 87 | { 88 | m_status &= ~st; 89 | } 90 | 91 | bool CStatus::hasStatus (unsigned st) const 92 | { 93 | return (m_status & st) != 0; 94 | } 95 | 96 | unsigned CStatus::status () const 97 | { 98 | return m_status; 99 | } 100 | 101 | bool CStatus::operator == (CStatus const & other) const 102 | { 103 | return m_status == other.m_status; 104 | } 105 | 106 | bool CStatus::operator != (CStatus const & other) const 107 | { 108 | return m_status != other.m_status; 109 | } 110 | 111 | /*! \brief Related non-members equal operator. */ 112 | inline bool operator == (CStatus const & s1, CStatus const & s2) 113 | { 114 | return s1.status () == s2.status (); 115 | } 116 | 117 | /*! \brief Related non-members not equal operator. */ 118 | inline bool operator != (CStatus const & s1, CStatus const & s2) 119 | { 120 | return s1.status () != s2.status (); 121 | } 122 | 123 | } // Namespace 124 | 125 | #endif // STATUS_HPP 126 | -------------------------------------------------------------------------------- /upnp/connectioninfo.cpp: -------------------------------------------------------------------------------- 1 | #include "connectioninfo.hpp" 2 | 3 | START_DEFINE_UPNP_NAMESPACE 4 | 5 | /*! \brief Internal strucure for CConnectionInfo. */ 6 | struct SConnectionInfoData : public QSharedData 7 | { 8 | SConnectionInfoData () {} 9 | SConnectionInfoData (SConnectionInfoData const & other); 10 | 11 | int m_rcsID = -1; 12 | int m_avTransportID = -1; 13 | QString m_protocolInfo; 14 | QString m_peerConnectionManager; 15 | int m_peerConnectionID = 0; 16 | QString m_direction = "Unknown"; 17 | QString m_status = "Unknown"; 18 | }; 19 | 20 | SConnectionInfoData::SConnectionInfoData (SConnectionInfoData const & other) : QSharedData (other), 21 | m_rcsID (other.m_rcsID), m_avTransportID (other.m_avTransportID), m_protocolInfo (other.m_protocolInfo), 22 | m_peerConnectionManager (other.m_peerConnectionManager), m_peerConnectionID (other.m_peerConnectionID), 23 | m_direction (other.m_direction), m_status (other.m_status) 24 | { 25 | } 26 | 27 | }//Namespace 28 | 29 | USING_UPNP_NAMESPACE 30 | 31 | CConnectionInfo::CConnectionInfo () : m_d (new SConnectionInfoData) 32 | { 33 | } 34 | 35 | CConnectionInfo::CConnectionInfo (CConnectionInfo const & rhs) : m_d (rhs.m_d) 36 | { 37 | } 38 | 39 | CConnectionInfo& CConnectionInfo::operator = (CConnectionInfo const & rhs) 40 | { 41 | if (this != &rhs) 42 | { 43 | m_d.operator = (rhs.m_d); 44 | } 45 | 46 | return *this; 47 | } 48 | 49 | CConnectionInfo::~CConnectionInfo () 50 | { 51 | } 52 | 53 | void CConnectionInfo::setRcsID (int id) 54 | { 55 | m_d->m_rcsID = id; 56 | } 57 | 58 | void CConnectionInfo::setAVTransportID (int id) 59 | { 60 | m_d->m_avTransportID = id; 61 | } 62 | 63 | void CConnectionInfo::setProtocolInfo (QString const & protocol) 64 | { 65 | m_d->m_protocolInfo = protocol; 66 | } 67 | 68 | void CConnectionInfo::setPeerConnectionManager (QString const & pcm) 69 | { 70 | m_d->m_peerConnectionManager = pcm; 71 | } 72 | 73 | void CConnectionInfo::setPeerConnectionID (int id) 74 | { 75 | m_d->m_peerConnectionID = id; 76 | } 77 | 78 | void CConnectionInfo::setDirection (QString const & dir) 79 | { 80 | m_d->m_direction = dir; 81 | } 82 | 83 | void CConnectionInfo::setStatus (QString const & st) 84 | { 85 | m_d->m_status = st; 86 | } 87 | 88 | int CConnectionInfo::rcsID () const 89 | { 90 | return m_d->m_rcsID; 91 | } 92 | 93 | int CConnectionInfo::avTransportID () const 94 | { 95 | return m_d->m_avTransportID; 96 | } 97 | 98 | QString const & CConnectionInfo::protocolInfo () const 99 | { 100 | return m_d->m_protocolInfo; 101 | } 102 | 103 | QString const & CConnectionInfo::peerConnectionManager () const 104 | { 105 | return m_d->m_peerConnectionManager; 106 | } 107 | 108 | int CConnectionInfo::peerConnectionID () const 109 | { 110 | return m_d->m_peerConnectionID; 111 | } 112 | 113 | QString const & CConnectionInfo::direction () const 114 | { 115 | return m_d->m_direction; 116 | } 117 | 118 | QString const & CConnectionInfo::status () const 119 | { 120 | return m_d->m_status; 121 | } 122 | --------------------------------------------------------------------------------