qt_avplay: avoid deprecated Xml_node methods

Besides replacing deprecated API calls, this patch also adds the 'base'
library to the target's LIBS (which is mandated by the change of issue
genodelabs/genode#3758) and changes the URL of the example mediafile
to a working one.

Issue genodelabs/genode#3755
This commit is contained in:
Norman Feske
2020-05-13 14:08:42 +02:00
parent b3fb51eb6f
commit 9bb7bfdb08
5 changed files with 24 additions and 18 deletions

View File

@@ -23,7 +23,7 @@ build $build_components
# Download media file # Download media file
# #
set media_url "ftp://ftp.untergrund.net/users/ae/dhstv/escape-chotro.mp4" set media_url "http://os.inf.tu-dresden.de/~nf2/povray/blob.mpg"
if {![file exists bin/mediafile]} { if {![file exists bin/mediafile]} {
puts "downloading media file from $media_url" puts "downloading media file from $media_url"
catch { exec wget -O bin/mediafile $media_url } catch { exec wget -O bin/mediafile $media_url }

View File

@@ -33,14 +33,12 @@ static inline void load_stylesheet()
qApp->setStyleSheet(QLatin1String(file.readAll())); qApp->setStyleSheet(QLatin1String(file.readAll()));
} }
extern void initialize_qt_core(Genode::Env &);
extern void initialize_qt_gui(Genode::Env &); extern void initialize_qt_gui(Genode::Env &);
void Libc::Component::construct(Libc::Env &env) void Libc::Component::construct(Libc::Env &env)
{ {
Libc::with_libc([&] { Libc::with_libc([&] {
initialize_qt_core(env);
initialize_qt_gui(env); initialize_qt_gui(env);
int argc = 1; int argc = 1;

View File

@@ -42,7 +42,7 @@ Main_window::Main_window(Genode::Env &env)
Avplay_slave *avplay_slave = new Avplay_slave(_env, _ep, Avplay_slave *avplay_slave = new Avplay_slave(_env, _ep,
_nitpicker_service, _nitpicker_service,
_mediafile_name.buf); _mediafile_name.name.string());
connect(_control_bar, SIGNAL(volume_changed(int)), avplay_slave, SLOT(volume_changed(int))); connect(_control_bar, SIGNAL(volume_changed(int)), avplay_slave, SLOT(volume_changed(int)));
} }

View File

@@ -43,21 +43,29 @@ class Main_window : public Compound_widget<QWidget, QVBoxLayout>
struct Mediafile_name struct Mediafile_name
{ {
/* get the name of the media file from the config file */ typedef Genode::String<256> Name;
enum { MAX_LEN_MEDIAFILE_NAME = 256 }; Name const name;
char buf[MAX_LEN_MEDIAFILE_NAME];
Mediafile_name(Genode::Env &env) Name _name_from_config(Genode::Env &env)
{ {
Genode::strncpy(buf, "mediafile", sizeof(buf)); using namespace Genode;
try {
Genode::Attached_rom_dataspace config(env, "config"); Attached_rom_dataspace config_ds(env, "config");
config.xml().sub_node("mediafile") Xml_node const config = config_ds.xml();
.attribute("name").value(buf, sizeof(buf)); char const * const node_type = "mediafile";
} catch(...) {
Genode::warning("no <mediafile> config node found, using \"mediafile\""); if (!config.has_sub_node(node_type))
} warning("no <", node_type, " name=\"...\"> config node found, "
"using \"mediafile\"");
Name result { "mediafile" };
config.with_sub_node(node_type, [&] (Xml_node const &mediafile) {
result = mediafile.attribute_value("name", result); });
return result;
} }
Mediafile_name(Genode::Env &env) : name(_name_from_config(env)) { }
}; };
Genode::Env &_env; Genode::Env &_env;

View File

@@ -2,8 +2,8 @@ include $(call select_from_repositories,src/app/qt5/tmpl/target_defaults.inc)
include $(call select_from_repositories,src/app/qt5/tmpl/target_final.inc) include $(call select_from_repositories,src/app/qt5/tmpl/target_final.inc)
LIBS += qt5_qnitpickerviewwidget qoost LIBS += qt5_qnitpickerviewwidget qoost base
REP_INC_DIR += include/qt5/qpa_nitpicker REP_INC_DIR += include/qt5/qpa_nitpicker
CC_CXX_WARN_STRICT = CC_CXX_WARN_STRICT =