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
#
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]} {
puts "downloading media file from $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()));
}
extern void initialize_qt_core(Genode::Env &);
extern void initialize_qt_gui(Genode::Env &);
void Libc::Component::construct(Libc::Env &env)
{
Libc::with_libc([&] {
initialize_qt_core(env);
initialize_qt_gui(env);
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,
_nitpicker_service,
_mediafile_name.buf);
_mediafile_name.name.string());
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
{
/* get the name of the media file from the config file */
enum { MAX_LEN_MEDIAFILE_NAME = 256 };
char buf[MAX_LEN_MEDIAFILE_NAME];
typedef Genode::String<256> Name;
Name const name;
Mediafile_name(Genode::Env &env)
Name _name_from_config(Genode::Env &env)
{
Genode::strncpy(buf, "mediafile", sizeof(buf));
try {
Genode::Attached_rom_dataspace config(env, "config");
config.xml().sub_node("mediafile")
.attribute("name").value(buf, sizeof(buf));
} catch(...) {
Genode::warning("no <mediafile> config node found, using \"mediafile\"");
}
using namespace Genode;
Attached_rom_dataspace config_ds(env, "config");
Xml_node const config = config_ds.xml();
char const * const node_type = "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;

View File

@@ -2,7 +2,7 @@ include $(call select_from_repositories,src/app/qt5/tmpl/target_defaults.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