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:
@@ -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;
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
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 =
|
||||
|
||||
Reference in New Issue
Block a user