RESULT eDVBScan::startFilter() { bool startSDT=true; int system; ASSERT(m_demux); /* only start required filters filter */ if (m_ready_all & readyPAT) startSDT = m_ready & readyPAT; // m_ch_current is not set, when eDVBScan is just used for a SDT update if (!m_ch_current) { unsigned int channelFlags; m_channel->getCurrentFrontendParameters(m_ch_current); m_ch_current->getFlags(channelFlags); if (channelFlags & iDVBFrontendParameters::flagOnlyFree) m_flags |= scanOnlyFree; } m_VCT = 0; m_ch_current->getSystem(system); if (system == iDVBFrontend::feATSC) { m_VCT = new eTable<VirtualChannelTableSection>; if (m_VCT->start(m_demux, eDVBVCTSpec())) return -1; CONNECT(m_VCT->tableReady, eDVBScan::VCTready); startSDT = false; } m_SDT = 0; if (startSDT && (m_ready_all & readySDT)) { m_SDT = new eTable<ServiceDescriptionSection>; int tsid=-1; if (m_ready & readyPAT && m_ready & validPAT) { std::vector<ProgramAssociationSection*>::const_iterator i = m_PAT->getSections().begin(); ASSERT(i != m_PAT->getSections().end()); tsid = (*i)->getTableIdExtension(); // in PAT this is the transport stream id m_pat_tsid = eTransportStreamID(tsid); for (; i != m_PAT->getSections().end(); ++i) { const ProgramAssociationSection &pat = **i; ProgramAssociationConstIterator program = pat.getPrograms()->begin(); for (; program != pat.getPrograms()->end(); ++program) m_pmts_to_read.insert(std::pair<unsigned short, service>((*program)->getProgramNumber(), service((*program)->getProgramMapPid()))); } m_PMT = new eTable<ProgramMapSection>; CONNECT(m_PMT->tableReady, eDVBScan::PMTready); PMTready(-2); // KabelBW HACK ... on 618Mhz and 626Mhz the transport stream id in PAT and SDT is different { int type; m_ch_current->getSystem(type); if (type == iDVBFrontend::feCable) { eDVBFrontendParametersCable parm; m_ch_current->getDVBC(parm); if ((tsid == 0x00d7 && absdiff(parm.frequency, 618000) < 2000) || (tsid == 0x00d8 && absdiff(parm.frequency, 626000) < 2000)) tsid = -1; } } } if (tsid == -1) { if (m_SDT->start(m_demux, eDVBSDTSpec())) return -1; } else if (m_SDT->start(m_demux, eDVBSDTSpec(tsid, true))) return -1; CONNECT(m_SDT->tableReady, eDVBScan::SDTready); } if (!(m_ready & readyPAT)) { m_PAT = 0; if (m_ready_all & readyPAT) { m_PAT = new eTable<ProgramAssociationSection>; if (m_PAT->start(m_demux, eDVBPATSpec(4000))) return -1; CONNECT(m_PAT->tableReady, eDVBScan::PATready); } m_NIT = 0; if (m_ready_all & readyNIT) { m_NIT = new eTable<NetworkInformationSection>; if (m_NIT->start(m_demux, eDVBNITSpec(m_networkid))) return -1; CONNECT(m_NIT->tableReady, eDVBScan::NITready); } m_BAT = 0; if (m_ready_all & readyBAT) { m_BAT = new eTable<BouquetAssociationSection>; if (m_BAT->start(m_demux, eDVBBATSpec())) return -1; CONNECT(m_BAT->tableReady, eDVBScan::BATready); } } return 0; }
QWidget* ExtensionDialog::CreateWidget( extension_widget_t *p_widget ) { QLabel *label = NULL; QPushButton *button = NULL; QTextBrowser *textArea = NULL; QLineEdit *textInput = NULL; QCheckBox *checkBox = NULL; QComboBox *comboBox = NULL; QListWidget *list = NULL; struct extension_widget_t::extension_widget_value_t *p_value = NULL; assert( p_widget->p_sys_intf == NULL ); switch( p_widget->type ) { case EXTENSION_WIDGET_LABEL: label = new QLabel( qfu( p_widget->psz_text ), this ); p_widget->p_sys_intf = label; label->setTextFormat( Qt::RichText ); label->setOpenExternalLinks( true ); return label; case EXTENSION_WIDGET_BUTTON: button = new QPushButton( qfu( p_widget->psz_text ), this ); clickMapper->setMapping( button, new WidgetMapper( p_widget ) ); CONNECT( button, clicked(), clickMapper, map() ); p_widget->p_sys_intf = button; return button; case EXTENSION_WIDGET_IMAGE: label = new QLabel( this ); label->setPixmap( QPixmap( qfu( p_widget->psz_text ) ) ); if( p_widget->i_width > 0 ) label->setMaximumWidth( p_widget->i_width ); if( p_widget->i_height > 0 ) label->setMaximumHeight( p_widget->i_height ); label->setScaledContents( true ); p_widget->p_sys_intf = label; return label; case EXTENSION_WIDGET_HTML: textArea = new QTextBrowser( this ); textArea->setOpenExternalLinks( true ); textArea->setHtml( qfu( p_widget->psz_text ) ); p_widget->p_sys_intf = textArea; return textArea; case EXTENSION_WIDGET_TEXT_FIELD: textInput = new QLineEdit( this ); textInput->setText( qfu( p_widget->psz_text ) ); textInput->setReadOnly( false ); textInput->setEchoMode( QLineEdit::Normal ); inputMapper->setMapping( textInput, new WidgetMapper( p_widget ) ); /// @note: maybe it would be wiser to use textEdited here? CONNECT( textInput, textChanged(const QString &), inputMapper, map() ); p_widget->p_sys_intf = textInput; return textInput; case EXTENSION_WIDGET_PASSWORD: textInput = new QLineEdit( this ); textInput->setText( qfu( p_widget->psz_text ) ); textInput->setReadOnly( false ); textInput->setEchoMode( QLineEdit::Password ); inputMapper->setMapping( textInput, new WidgetMapper( p_widget ) ); /// @note: maybe it would be wiser to use textEdited here? CONNECT( textInput, textChanged(const QString &), inputMapper, map() ); p_widget->p_sys_intf = textInput; return textInput; case EXTENSION_WIDGET_CHECK_BOX: checkBox = new QCheckBox( this ); checkBox->setText( qfu( p_widget->psz_text ) ); checkBox->setChecked( p_widget->b_checked ); clickMapper->setMapping( checkBox, new WidgetMapper( p_widget ) ); CONNECT( checkBox, stateChanged( int ), clickMapper, map() ); p_widget->p_sys_intf = checkBox; return checkBox; case EXTENSION_WIDGET_DROPDOWN: comboBox = new QComboBox( this ); comboBox->setEditable( false ); for( p_value = p_widget->p_values; p_value != NULL; p_value = p_value->p_next ) { comboBox->addItem( qfu( p_value->psz_text ), p_value->i_id ); } /* Set current item */ if( p_widget->psz_text ) { int idx = comboBox->findText( qfu( p_widget->psz_text ) ); if( idx >= 0 ) comboBox->setCurrentIndex( idx ); } selectMapper->setMapping( comboBox, new WidgetMapper( p_widget ) ); CONNECT( comboBox, currentIndexChanged( const QString& ), selectMapper, map() ); return comboBox; case EXTENSION_WIDGET_LIST: list = new QListWidget( this ); list->setSelectionMode( QAbstractItemView::ExtendedSelection ); for( p_value = p_widget->p_values; p_value != NULL; p_value = p_value->p_next ) { QListWidgetItem *item = new QListWidgetItem( qfu( p_value->psz_text ) ); item->setData( Qt::UserRole, p_value->i_id ); list->addItem( item ); } selectMapper->setMapping( list, new WidgetMapper( p_widget ) ); CONNECT( list, itemSelectionChanged(), selectMapper, map() ); return list; default: msg_Err( p_intf, "Widget type %d unknown", p_widget->type ); return NULL; } }
eBitrateCalc::eBitrateCalc(int pid, int dvbnamespace, int tsid, int onid, int refreshintervall, int buffer_size): m_size(0), m_refresh_intervall(refreshintervall) { m_send_data_timer = eTimer::create(eApp); CONNECT(m_send_data_timer->timeout, eBitrateCalc::sendDataTimerTimeoutCB); eDVBChannelID chid; //(eDVBNamespace(dvbnamespace), eTransportStreamID(tsid), eOriginalNetworkID(onid)); <-- weird, that does not work chid.dvbnamespace = eDVBNamespace(dvbnamespace); chid.transport_stream_id = eTransportStreamID(tsid); chid.original_network_id = eOriginalNetworkID(onid); ePtr<eDVBResourceManager> res_mgr; eDVBResourceManager::getInstance(res_mgr); eUsePtr<iDVBChannel> channel; int success = 0; m_reader = NULL; if (!res_mgr->allocateChannel(chid, channel, false)) { ePtr<iDVBDemux> demux; if (!channel->getDemux(demux)) { if (!demux->createPESReader(eApp, m_reader)) { if (!m_reader->connectRead(slot(*this, &eBitrateCalc::dataReady), m_pes_connection)) { channel->connectStateChange(slot(*this, &eBitrateCalc::stateChange), m_channel_connection); success = 1; } else eDebug("[eBitrateCalc] connect pes reader failed..."); } else eDebug("[eBitrateCalc] create PES reader failed..."); } else eDebug("[eBitrateCalc] getDemux failed..."); } else { eDebug("[eBitrateCalc] allocate channel failed...trying pvr_allocate_demux"); ePtr<eDVBAllocatedDemux> pvr_allocated_demux; int i = 0; if (!res_mgr->allocateDemux(NULL,pvr_allocated_demux,i)) { eDVBDemux &demux = pvr_allocated_demux->get(); if (!demux.createPESReader(eApp, m_reader)) { if (!m_reader->connectRead(slot(*this, &eBitrateCalc::dataReady), m_pes_connection)) success = 1; else eDebug("[eBitrateCalc] connect pes reader failed..."); } else eDebug("[eBitrateCalc] create PES reader failed..."); } else eDebug("[eBitrateCalc] allocate pvr_allocated_demux failed..."); } if (m_reader and success) { clock_gettime(CLOCK_MONOTONIC, &m_start); m_reader->setBufferSize(buffer_size); m_reader->start(pid); m_send_data_timer->start(m_refresh_intervall, true); } else sendData(-1,0); }
static gboolean nsgtk_window_draw_event(GtkWidget *widget, cairo_t *cr, gpointer data) { struct gui_window *gw = data; struct gui_window *z; struct rect clip; struct redraw_context ctx = { .interactive = true, .background_images = true, .plot = &nsgtk_plotters }; double x1; double y1; double x2; double y2; assert(gw); assert(gw->bw); for (z = window_list; z && z != gw; z = z->next) continue; assert(z); assert(GTK_WIDGET(gw->layout) == widget); current_widget = (GtkWidget *)gw->layout; current_cr = cr; GtkAdjustment *vscroll = nsgtk_layout_get_vadjustment(gw->layout); GtkAdjustment *hscroll = nsgtk_layout_get_hadjustment(gw->layout); cairo_clip_extents(cr, &x1, &y1, &x2, &y2); clip.x0 = x1; clip.y0 = y1; clip.x1 = x2; clip.y1 = y2; browser_window_redraw(gw->bw, -gtk_adjustment_get_value(hscroll), -gtk_adjustment_get_value(vscroll), &clip, &ctx); if (gw->careth != 0) { nsgtk_plot_caret(gw->caretx, gw->carety, gw->careth); } current_widget = NULL; return FALSE; } #else static gboolean nsgtk_window_draw_event(GtkWidget *widget, GdkEventExpose *event, gpointer data) { struct gui_window *gw = data; struct gui_window *z; struct rect clip; struct redraw_context ctx = { .interactive = true, .background_images = true, .plot = &nsgtk_plotters }; assert(gw); assert(gw->bw); for (z = window_list; z && z != gw; z = z->next) continue; assert(z); assert(GTK_WIDGET(gw->layout) == widget); current_widget = (GtkWidget *)gw->layout; current_cr = gdk_cairo_create(nsgtk_layout_get_bin_window(gw->layout)); clip.x0 = event->area.x; clip.y0 = event->area.y; clip.x1 = event->area.x + event->area.width; clip.y1 = event->area.y + event->area.height; browser_window_redraw(gw->bw, 0, 0, &clip, &ctx); if (gw->careth != 0) { nsgtk_plot_caret(gw->caretx, gw->carety, gw->careth); } cairo_destroy(current_cr); current_widget = NULL; return FALSE; } #endif static gboolean nsgtk_window_motion_notify_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) { struct gui_window *g = data; bool shift = event->state & GDK_SHIFT_MASK; bool ctrl = event->state & GDK_CONTROL_MASK; if ((abs(event->x - g->last_x) < 5) && (abs(event->y - g->last_y) < 5)) { /* Mouse hasn't moved far enough from press coordinate for this * to be considered a drag. */ return FALSE; } else { /* This is a drag, ensure it's always treated as such, even if * we drag back over the press location */ g->last_x = INT_MIN; g->last_y = INT_MIN; } if (g->mouse.state & BROWSER_MOUSE_PRESS_1) { /* Start button 1 drag */ browser_window_mouse_click(g->bw, BROWSER_MOUSE_DRAG_1, g->mouse.pressed_x, g->mouse.pressed_y); /* Replace PRESS with HOLDING and declare drag in progress */ g->mouse.state ^= (BROWSER_MOUSE_PRESS_1 | BROWSER_MOUSE_HOLDING_1); g->mouse.state |= BROWSER_MOUSE_DRAG_ON; } else if (g->mouse.state & BROWSER_MOUSE_PRESS_2) { /* Start button 2 drag */ browser_window_mouse_click(g->bw, BROWSER_MOUSE_DRAG_2, g->mouse.pressed_x, g->mouse.pressed_y); /* Replace PRESS with HOLDING and declare drag in progress */ g->mouse.state ^= (BROWSER_MOUSE_PRESS_2 | BROWSER_MOUSE_HOLDING_2); g->mouse.state |= BROWSER_MOUSE_DRAG_ON; } /* Handle modifiers being removed */ if (g->mouse.state & BROWSER_MOUSE_MOD_1 && !shift) g->mouse.state ^= BROWSER_MOUSE_MOD_1; if (g->mouse.state & BROWSER_MOUSE_MOD_2 && !ctrl) g->mouse.state ^= BROWSER_MOUSE_MOD_2; browser_window_mouse_track(g->bw, g->mouse.state, event->x / browser_window_get_scale(g->bw), event->y / browser_window_get_scale(g->bw)); return TRUE; } static gboolean nsgtk_window_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data) { struct gui_window *g = data; gtk_widget_grab_focus(GTK_WIDGET(g->layout)); gtk_widget_hide(GTK_WIDGET(nsgtk_scaffolding_history_window( g->scaffold)->window)); g->mouse.pressed_x = event->x / browser_window_get_scale(g->bw); g->mouse.pressed_y = event->y / browser_window_get_scale(g->bw); switch (event->button) { case 1: /* Left button, usually. Pass to core as BUTTON 1. */ g->mouse.state = BROWSER_MOUSE_PRESS_1; break; case 2: /* Middle button, usually. Pass to core as BUTTON 2 */ g->mouse.state = BROWSER_MOUSE_PRESS_2; break; case 3: /* Right button, usually. Action button, context menu. */ browser_window_remove_caret(g->bw, true); nsgtk_scaffolding_popup_menu(g->scaffold, g->mouse.pressed_x, g->mouse.pressed_y); return TRUE; default: return FALSE; } /* Modify for double & triple clicks */ if (event->type == GDK_3BUTTON_PRESS) g->mouse.state |= BROWSER_MOUSE_TRIPLE_CLICK; else if (event->type == GDK_2BUTTON_PRESS) g->mouse.state |= BROWSER_MOUSE_DOUBLE_CLICK; /* Handle the modifiers too */ if (event->state & GDK_SHIFT_MASK) g->mouse.state |= BROWSER_MOUSE_MOD_1; if (event->state & GDK_CONTROL_MASK) g->mouse.state |= BROWSER_MOUSE_MOD_2; /* Record where we pressed, for use when determining whether to start * a drag in motion notify events. */ g->last_x = event->x; g->last_y = event->y; browser_window_mouse_click(g->bw, g->mouse.state, g->mouse.pressed_x, g->mouse.pressed_y); return TRUE; } static gboolean nsgtk_window_button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer data) { struct gui_window *g = data; bool shift = event->state & GDK_SHIFT_MASK; bool ctrl = event->state & GDK_CONTROL_MASK; /* If the mouse state is PRESS then we are waiting for a release to emit * a click event, otherwise just reset the state to nothing */ if (g->mouse.state & BROWSER_MOUSE_PRESS_1) g->mouse.state ^= (BROWSER_MOUSE_PRESS_1 | BROWSER_MOUSE_CLICK_1); else if (g->mouse.state & BROWSER_MOUSE_PRESS_2) g->mouse.state ^= (BROWSER_MOUSE_PRESS_2 | BROWSER_MOUSE_CLICK_2); /* Handle modifiers being removed */ if (g->mouse.state & BROWSER_MOUSE_MOD_1 && !shift) g->mouse.state ^= BROWSER_MOUSE_MOD_1; if (g->mouse.state & BROWSER_MOUSE_MOD_2 && !ctrl) g->mouse.state ^= BROWSER_MOUSE_MOD_2; if (g->mouse.state & (BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_CLICK_2)) { browser_window_mouse_click(g->bw, g->mouse.state, event->x / browser_window_get_scale(g->bw), event->y / browser_window_get_scale(g->bw)); } else { browser_window_mouse_track(g->bw, 0, event->x / browser_window_get_scale(g->bw), event->y / browser_window_get_scale(g->bw)); } g->mouse.state = 0; return TRUE; } static gboolean nsgtk_window_scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer data) { struct gui_window *g = data; double value; double deltax = 0; double deltay = 0; GtkAdjustment *vscroll = nsgtk_layout_get_vadjustment(g->layout); GtkAdjustment *hscroll = nsgtk_layout_get_hadjustment(g->layout); GtkAllocation alloc; switch (event->direction) { case GDK_SCROLL_LEFT: deltax = -1.0; break; case GDK_SCROLL_UP: deltay = -1.0; break; case GDK_SCROLL_RIGHT: deltax = 1.0; break; case GDK_SCROLL_DOWN: deltay = 1.0; break; #if GTK_CHECK_VERSION(3,4,0) case GDK_SCROLL_SMOOTH: gdk_event_get_scroll_deltas((GdkEvent *)event, &deltax, &deltay); break; #endif default: LOG(("Unhandled mouse scroll direction")); return TRUE; } deltax *= nsgtk_adjustment_get_step_increment(hscroll); deltay *= nsgtk_adjustment_get_step_increment(vscroll); if (browser_window_scroll_at_point(g->bw, event->x / browser_window_get_scale(g->bw), event->y / browser_window_get_scale(g->bw), deltax, deltay) != true) { /* core did not handle event so change adjustments */ /* Horizontal */ if (deltax != 0) { value = gtk_adjustment_get_value(hscroll) + deltax; /* @todo consider gtk_widget_get_allocated_width() */ nsgtk_widget_get_allocation(GTK_WIDGET(g->layout), &alloc); if (value > nsgtk_adjustment_get_upper(hscroll) - alloc.width) { value = nsgtk_adjustment_get_upper(hscroll) - alloc.width; } if (value < nsgtk_adjustment_get_lower(hscroll)) { value = nsgtk_adjustment_get_lower(hscroll); } gtk_adjustment_set_value(hscroll, value); } /* Vertical */ if (deltay != 0) { value = gtk_adjustment_get_value(vscroll) + deltay; /* @todo consider gtk_widget_get_allocated_height */ nsgtk_widget_get_allocation(GTK_WIDGET(g->layout), &alloc); if (value > (nsgtk_adjustment_get_upper(vscroll) - alloc.height)) { value = nsgtk_adjustment_get_upper(vscroll) - alloc.height; } if (value < nsgtk_adjustment_get_lower(vscroll)) { value = nsgtk_adjustment_get_lower(vscroll); } gtk_adjustment_set_value(vscroll, value); } } return TRUE; } static gboolean nsgtk_window_keypress_event(GtkWidget *widget, GdkEventKey *event, gpointer data) { struct gui_window *g = data; uint32_t nskey = gtk_gui_gdkkey_to_nskey(event); if (browser_window_key_press(g->bw, nskey)) return TRUE; if ((event->state & 0x7) != 0) return TRUE; double value; GtkAdjustment *vscroll = nsgtk_layout_get_vadjustment(g->layout); GtkAdjustment *hscroll = nsgtk_layout_get_hadjustment(g->layout); GtkAllocation alloc; /* @todo consider gtk_widget_get_allocated_width() */ nsgtk_widget_get_allocation(GTK_WIDGET(g->layout), &alloc); switch (event->keyval) { case GDK_KEY(Home): case GDK_KEY(KP_Home): value = nsgtk_adjustment_get_lower(vscroll); gtk_adjustment_set_value(vscroll, value); break; case GDK_KEY(End): case GDK_KEY(KP_End): value = nsgtk_adjustment_get_upper(vscroll) - alloc.height; if (value < nsgtk_adjustment_get_lower(vscroll)) value = nsgtk_adjustment_get_lower(vscroll); gtk_adjustment_set_value(vscroll, value); break; case GDK_KEY(Left): case GDK_KEY(KP_Left): value = gtk_adjustment_get_value(hscroll) - nsgtk_adjustment_get_step_increment(hscroll); if (value < nsgtk_adjustment_get_lower(hscroll)) value = nsgtk_adjustment_get_lower(hscroll); gtk_adjustment_set_value(hscroll, value); break; case GDK_KEY(Up): case GDK_KEY(KP_Up): value = gtk_adjustment_get_value(vscroll) - nsgtk_adjustment_get_step_increment(vscroll); if (value < nsgtk_adjustment_get_lower(vscroll)) value = nsgtk_adjustment_get_lower(vscroll); gtk_adjustment_set_value(vscroll, value); break; case GDK_KEY(Right): case GDK_KEY(KP_Right): value = gtk_adjustment_get_value(hscroll) + nsgtk_adjustment_get_step_increment(hscroll); if (value > nsgtk_adjustment_get_upper(hscroll) - alloc.width) value = nsgtk_adjustment_get_upper(hscroll) - alloc.width; gtk_adjustment_set_value(hscroll, value); break; case GDK_KEY(Down): case GDK_KEY(KP_Down): value = gtk_adjustment_get_value(vscroll) + nsgtk_adjustment_get_step_increment(vscroll); if (value > nsgtk_adjustment_get_upper(vscroll) - alloc.height) value = nsgtk_adjustment_get_upper(vscroll) - alloc.height; gtk_adjustment_set_value(vscroll, value); break; case GDK_KEY(Page_Up): case GDK_KEY(KP_Page_Up): value = gtk_adjustment_get_value(vscroll) - nsgtk_adjustment_get_page_increment(vscroll); if (value < nsgtk_adjustment_get_lower(vscroll)) value = nsgtk_adjustment_get_lower(vscroll); gtk_adjustment_set_value(vscroll, value); break; case GDK_KEY(Page_Down): case GDK_KEY(KP_Page_Down): value = gtk_adjustment_get_value(vscroll) + nsgtk_adjustment_get_page_increment(vscroll); if (value > nsgtk_adjustment_get_upper(vscroll) - alloc.height) value = nsgtk_adjustment_get_upper(vscroll) - alloc.height; gtk_adjustment_set_value(vscroll, value); break; default: break; } return TRUE; } static gboolean nsgtk_window_size_allocate_event(GtkWidget *widget, GtkAllocation *allocation, gpointer data) { struct gui_window *g = data; g->bw->reformat_pending = true; browser_reformat_pending = true; return TRUE; } /** when the pane position is changed update the user option * * The slightly awkward implementation with the first allocation flag * is necessary because the initial window creation does not cause an * allocate-event signal so the position value in the pane is incorrect * and we cannot know what it should be until after the allocation * (which did not generate a signal) is done as the user position is a * percentage of pane total width not an absolute value. */ static void nsgtk_paned_notify__position(GObject *gobject, GParamSpec *pspec, gpointer data) { struct gui_window *g = data; GtkAllocation pane_alloc; gtk_widget_get_allocation(GTK_WIDGET(g->paned), &pane_alloc); if (g->paned_sized == false) { g->paned_sized = true; gtk_paned_set_position(g->paned, (nsoption_int(toolbar_status_size) * pane_alloc.width) / 10000); return; } nsoption_set_int(toolbar_status_size, ((gtk_paned_get_position(g->paned) * 10000) / (pane_alloc.width - 1))); } /** Set status bar / scroll bar proportion according to user option * when pane is resized. */ static gboolean nsgtk_paned_size_allocate_event(GtkWidget *widget, GtkAllocation *allocation, gpointer data) { gtk_paned_set_position(GTK_PANED(widget), (nsoption_int(toolbar_status_size) * allocation->width) / 10000); return TRUE; } /* destroy the browsing context as there is nothing to display it now */ static void window_destroy(GtkWidget *widget, gpointer data) { struct gui_window *gw = data; browser_window_destroy(gw->bw); } /* Core interface documented in desktop/gui.h to create a gui_window */ static struct gui_window * gui_window_create(struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags) { struct gui_window *g; /**< what we're creating to return */ GError* error = NULL; bool tempback; GtkBuilder* xml; /* open builder file first to ease error handling on faliure */ xml = gtk_builder_new(); if (!gtk_builder_add_from_file(xml, glade_file_location->tabcontents, &error)) { g_warning ("Couldn't load builder file: %s", error->message); g_error_free(error); return NULL; } g = calloc(1, sizeof(*g)); if (!g) { warn_user("NoMemory", 0); g_object_unref(xml); return NULL; } LOG(("Creating gui window %p for browser window %p", g, bw)); g->bw = bw; g->mouse.state = 0; g->current_pointer = GUI_POINTER_DEFAULT; if (flags & GW_CREATE_CLONE) { assert(existing != NULL); bw->scale = existing->bw->scale; } else { bw->scale = nsoption_int(scale) / 100; } /* attach scaffold */ if (flags & GW_CREATE_TAB) { assert(existing != NULL); g->scaffold = existing->scaffold; } else { /* Now construct and attach a scaffold */ g->scaffold = nsgtk_new_scaffolding(g); } if (g->scaffold == NULL) { warn_user("NoMemory", 0); free(g); g_object_unref(xml); return NULL; } /* Construct our primary elements */ g->container = GTK_WIDGET(gtk_builder_get_object(xml, "tabContents")); g->layout = GTK_LAYOUT(gtk_builder_get_object(xml, "layout")); g->status_bar = GTK_LABEL(gtk_builder_get_object(xml, "status_bar")); g->paned = GTK_PANED(gtk_builder_get_object(xml, "hpaned1")); /* add new gui window to global list (push_top) */ if (window_list) { window_list->prev = g; } g->next = window_list; g->prev = NULL; window_list = g; /* set the events we're interested in receiving from the browser's * drawing area. */ gtk_widget_add_events(GTK_WIDGET(g->layout), GDK_EXPOSURE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_SCROLL_MASK); nsgtk_widget_set_can_focus(GTK_WIDGET(g->layout), TRUE); /* set the default background colour of the drawing area to white. */ nsgtk_widget_override_background_color(GTK_WIDGET(g->layout), GTK_STATE_NORMAL, 0, 0xffff, 0xffff, 0xffff); nsgtk_connect_draw_event(GTK_WIDGET(g->layout), G_CALLBACK(nsgtk_window_draw_event), g); /* layout signals */ CONNECT(g->layout, "motion-notify-event", nsgtk_window_motion_notify_event, g); g->signalhandler[NSGTK_WINDOW_SIGNAL_CLICK] = CONNECT(g->layout, "button-press-event", nsgtk_window_button_press_event, g); CONNECT(g->layout, "button-release-event", nsgtk_window_button_release_event, g); CONNECT(g->layout, "key-press-event", nsgtk_window_keypress_event, g); CONNECT(g->layout, "size-allocate", nsgtk_window_size_allocate_event, g); CONNECT(g->layout, "scroll-event", nsgtk_window_scroll_event, g); /* status pane signals */ CONNECT(g->paned, "size-allocate", nsgtk_paned_size_allocate_event, g); CONNECT(g->paned, "notify::position", nsgtk_paned_notify__position, g); /* gtk container destructor */ CONNECT(g->container, "destroy", window_destroy, g); /* add the tab container to the scaffold notebook */ switch (temp_open_background) { case -1: tempback = !(nsoption_bool(focus_new)); break; case 0: tempback = false; break; default: tempback = true; break; } nsgtk_tab_add(g, g->container, tempback); /* safe to drop the reference to the xml as the container is * referenced by the notebook now. */ g_object_unref(xml); return g; } void nsgtk_reflow_all_windows(void) { for (struct gui_window *g = window_list; g; g = g->next) { nsgtk_tab_options_changed( nsgtk_scaffolding_notebook(g->scaffold)); g->bw->reformat_pending = true; } browser_reformat_pending = true; } /** * Process pending reformats */ void nsgtk_window_process_reformats(void) { struct gui_window *g; GtkAllocation alloc; browser_reformat_pending = false; for (g = window_list; g; g = g->next) { if (!g->bw->reformat_pending) continue; g->bw->reformat_pending = false; /* @todo consider gtk_widget_get_allocated_width() */ nsgtk_widget_get_allocation(GTK_WIDGET(g->layout), &alloc); browser_window_reformat(g->bw, false, alloc.width, alloc.height); } } void nsgtk_window_destroy_browser(struct gui_window *gw) { /* remove tab */ gtk_widget_destroy(gw->container); }
eDVBPMTParser::eDVBPMTParser() { CONNECT(m_PMT.tableReady, eDVBPMTParser::PMTready); }
eServiceMP3::eServiceMP3(eServiceReference ref) :m_ref(ref), m_pump(eApp, 1) { m_subtitle_sync_timer = eTimer::create(eApp); m_streamingsrc_timeout = 0; m_stream_tags = 0; m_currentAudioStream = -1; m_currentSubtitleStream = -1; m_subtitle_widget = 0; m_currentTrickRatio = 1.0; m_buffer_size = 1*1024*1024; m_prev_decoder_time = -1; m_decoder_time_valid_state = 0; m_errorInfo.missing_codec = ""; CONNECT(m_subtitle_sync_timer->timeout, eServiceMP3::pushSubtitles); CONNECT(m_pump.recv_msg, eServiceMP3::gstPoll); m_aspect = m_width = m_height = m_framerate = m_progressive = -1; m_state = stIdle; eDebug("eServiceMP3::construct!"); const char *filename = m_ref.path.c_str(); const char *ext = strrchr(filename, '.'); if (!ext) ext = filename; m_sourceinfo.is_video = FALSE; m_sourceinfo.audiotype = atUnknown; if ( (strcasecmp(ext, ".mpeg") && strcasecmp(ext, ".mpg") && strcasecmp(ext, ".vob") && strcasecmp(ext, ".bin") && strcasecmp(ext, ".dat") ) == 0 ) { m_sourceinfo.containertype = ctMPEGPS; m_sourceinfo.is_video = TRUE; } else if ( strcasecmp(ext, ".ts") == 0 ) { m_sourceinfo.containertype = ctMPEGTS; m_sourceinfo.is_video = TRUE; } else if ( strcasecmp(ext, ".mkv") == 0 ) { m_sourceinfo.containertype = ctMKV; m_sourceinfo.is_video = TRUE; } else if ( strcasecmp(ext, ".avi") == 0 || strcasecmp(ext, ".divx") == 0) { m_sourceinfo.containertype = ctAVI; m_sourceinfo.is_video = TRUE; } else if ( strcasecmp(ext, ".mp4") == 0 || strcasecmp(ext, ".mov") == 0 || strcasecmp(ext, ".m4v") == 0) { m_sourceinfo.containertype = ctMP4; m_sourceinfo.is_video = TRUE; } else if ( strcasecmp(ext, ".m4a") == 0 ) { m_sourceinfo.containertype = ctMP4; m_sourceinfo.audiotype = atAAC; } else if ( strcasecmp(ext, ".mp3") == 0 ) m_sourceinfo.audiotype = atMP3; else if ( (strncmp(filename, "/autofs/", 8) || strncmp(filename+strlen(filename)-13, "/track-", 7) || strcasecmp(ext, ".wav")) == 0 ) m_sourceinfo.containertype = ctCDA; if ( strcasecmp(ext, ".dat") == 0 ) { m_sourceinfo.containertype = ctVCD; m_sourceinfo.is_video = TRUE; } if ( strstr(filename, "://") ) m_sourceinfo.is_streaming = TRUE; gchar *uri; if ( m_sourceinfo.is_streaming ) { uri = g_strdup_printf ("%s", filename); m_streamingsrc_timeout = eTimer::create(eApp);; CONNECT(m_streamingsrc_timeout->timeout, eServiceMP3::sourceTimeout); std::string config_str; if( ePythonConfigQuery::getConfigValue("config.mediaplayer.useAlternateUserAgent", config_str) == 0 ) { if ( config_str == "True" ) ePythonConfigQuery::getConfigValue("config.mediaplayer.alternateUserAgent", m_useragent); } if ( m_useragent.length() == 0 ) m_useragent = "Dream Multimedia Dreambox Enigma2 Mediaplayer"; } else if ( m_sourceinfo.containertype == ctCDA ) { int i_track = atoi(filename+18); uri = g_strdup_printf ("cdda://%i", i_track); } else if ( m_sourceinfo.containertype == ctVCD ) { int fd = open(filename,O_RDONLY); char tmp[128*1024]; int ret = read(fd, tmp, 128*1024); close(fd); if ( ret == -1 ) // this is a "REAL" VCD uri = g_strdup_printf ("vcd://"); else uri = g_filename_to_uri(filename, NULL, NULL); } else uri = g_filename_to_uri(filename, NULL, NULL); eDebug("eServiceMP3::playbin2 uri=%s", uri); m_gst_playbin = gst_element_factory_make("playbin2", "playbin"); if (!m_gst_playbin) m_errorInfo.error_message = "failed to create GStreamer pipeline!\n"; g_object_set (G_OBJECT (m_gst_playbin), "uri", uri, NULL); int flags = 0x47; // ( GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_AUDIO | GST_PLAY_FLAG_NATIVE_VIDEO | GST_PLAY_FLAG_TEXT ); g_object_set (G_OBJECT (m_gst_playbin), "flags", flags, NULL); g_free(uri); GstElement *subsink = gst_element_factory_make("subsink", "subtitle_sink"); if (!subsink) eDebug("eServiceMP3::sorry, can't play: missing gst-plugin-subsink"); else { m_subs_to_pull_handler_id = g_signal_connect (subsink, "new-buffer", G_CALLBACK (gstCBsubtitleAvail), this); g_object_set (G_OBJECT (subsink), "caps", gst_caps_from_string("text/plain; text/x-plain; text/x-pango-markup; video/x-dvd-subpicture; subpicture/x-pgs"), NULL); g_object_set (G_OBJECT (m_gst_playbin), "text-sink", subsink, NULL); g_object_set (G_OBJECT (m_gst_playbin), "current-text", m_currentSubtitleStream, NULL); } if ( m_gst_playbin ) { gst_bus_set_sync_handler(gst_pipeline_get_bus (GST_PIPELINE (m_gst_playbin)), gstBusSyncHandler, this); char srt_filename[strlen(filename)+1]; strncpy(srt_filename,filename,strlen(filename)-3); srt_filename[strlen(filename)-3]='\0'; strcat(srt_filename, "srt"); struct stat buffer; if (stat(srt_filename, &buffer) == 0) { eDebug("eServiceMP3::subtitle uri: %s", g_filename_to_uri(srt_filename, NULL, NULL)); g_object_set (G_OBJECT (m_gst_playbin), "suburi", g_filename_to_uri(srt_filename, NULL, NULL), NULL); } if ( m_sourceinfo.is_streaming ) { g_signal_connect (G_OBJECT (m_gst_playbin), "notify::source", G_CALLBACK (gstHTTPSourceSetAgent), this); } } else { m_event((iPlayableService*)this, evUser+12); if (m_gst_playbin) gst_object_unref(GST_OBJECT(m_gst_playbin)); eDebug("eServiceMP3::sorry, can't play: %s",m_errorInfo.error_message.c_str()); m_gst_playbin = 0; } setBufferSize(m_buffer_size); }
/** * View Menu * Interface Modification **/ QMenu *QVLCMenu::ViewMenu( intf_thread_t *p_intf, MainInterface *mi, bool with_intf ) { assert( mi ); QMenu *menu = new QMenu( qtr( "V&iew" ), mi ); QAction *act = menu->addAction( QIcon( ":/menu/playlist_menu" ), qtr( "Play&list" ), mi, SLOT( togglePlaylist() ), qtr( "Ctrl+L" ) ); /*menu->addSeparator(); menu->addAction( qtr( "Undock from Interface" ), mi, SLOT( undockPlaylist() ), qtr( "Ctrl+U" ) );*/ menu->addSeparator(); if( with_intf ) { QMenu *intfmenu = InterfacesMenu( p_intf, menu ); MenuFunc *f = new MenuFunc( intfmenu, 4 ); CONNECT( intfmenu, aboutToShow(), THEDP->menusUpdateMapper, map() ); THEDP->menusUpdateMapper->setMapping( intfmenu, f ); menu->addSeparator(); } /* Minimal View */ QAction *action = menu->addAction( qtr( "Mi&nimal View" ) ); action->setShortcut( qtr( "Ctrl+H" ) ); action->setCheckable( true ); action->setChecked( !with_intf && (mi->getControlsVisibilityStatus() & CONTROLS_HIDDEN ) ); CONNECT( action, triggered( bool ), mi, toggleMinimalView( bool ) ); CONNECT( mi, minimalViewToggled( bool ), action, setChecked( bool ) ); /* FullScreen View */ action = menu->addAction( qtr( "&Fullscreen Interface" ), mi, SLOT( toggleFullScreen() ), QString( "F11" ) ); action->setCheckable( true ); action->setChecked( mi->isFullScreen() ); CONNECT( mi, fullscreenInterfaceToggled( bool ), action, setChecked( bool ) ); /* Advanced Controls */ action = menu->addAction( qtr( "&Advanced Controls" ), mi, SLOT( toggleAdvanced() ) ); action->setCheckable( true ); if( mi->getControlsVisibilityStatus() & CONTROLS_ADVANCED ) action->setChecked( true ); if( with_intf ) // I don't want to manage consistency between menus, so no popup-menu { action = menu->addAction( qtr( "Quit after Playback" ) ); action->setCheckable( true ); CONNECT( action, triggered( bool ), THEMIM, activatePlayQuit( bool ) ); } #if 0 /* For Visualisations. Not yet working */ adv = menu->addAction( qtr( "Visualizations selector" ), mi, SLOT( visual() ) ); adv->setCheckable( true ); if( visual_selector_enabled ) adv->setChecked( true ); #endif menu->addSeparator(); addDPStaticEntry( menu, qtr( "Customi&ze Interface..." ), ":/menu/preferences", SLOT( toolbarDialog() ) ); menu->addSeparator(); return menu; }
QWidget *AbstractController::createWidget( buttonType_e button, int options ) { bool b_flat = options & WIDGET_FLAT; bool b_big = options & WIDGET_BIG; bool b_shiny = options & WIDGET_SHINY; bool b_special = false; QWidget *widget = NULL; switch( button ) { case PLAY_BUTTON: { PlayButton *playButton = new PlayButton; setupButton( playButton ); BUTTON_SET_BAR( playButton ); CONNECT_MAP_SET( playButton, PLAY_ACTION ); CONNECT( this, inputPlaying( bool ), playButton, updateButtonIcons( bool )); playButton->updateButtonIcons( THEMIM->getIM()->playingStatus() == PLAYING_S ); widget = playButton; } break; case STOP_BUTTON:{ NORMAL_BUTTON( STOP ); } break; case OPEN_BUTTON:{ NORMAL_BUTTON( OPEN ); } break; case OPEN_SUB_BUTTON:{ NORMAL_BUTTON( OPEN_SUB ); } break; case PREVIOUS_BUTTON:{ NORMAL_BUTTON( PREVIOUS ); } break; case NEXT_BUTTON: { NORMAL_BUTTON( NEXT ); } break; case SLOWER_BUTTON:{ NORMAL_BUTTON( SLOWER ); ENABLE_ON_INPUT( SLOWERButton ); } break; case FASTER_BUTTON:{ NORMAL_BUTTON( FASTER ); ENABLE_ON_INPUT( FASTERButton ); } break; case PREV_SLOW_BUTTON:{ QToolButtonExt *but = new QToolButtonExt; setupButton( but ); BUTTON_SET_BAR( but ); CONNECT( but, shortClicked(), THEMIM, prev() ); CONNECT( but, longClicked(), THEAM, skipBackward() ); widget = but; } break; case NEXT_FAST_BUTTON:{ QToolButtonExt *but = new QToolButtonExt; setupButton( but ); BUTTON_SET_BAR( but ); CONNECT( but, shortClicked(), THEMIM, next() ); CONNECT( but, longClicked(), THEAM, skipForward() ); widget = but; } break; case FRAME_BUTTON: { NORMAL_BUTTON( FRAME ); ENABLE_ON_VIDEO( FRAMEButton ); } break; case FULLSCREEN_BUTTON: case DEFULLSCREEN_BUTTON: { NORMAL_BUTTON( FULLSCREEN ); ENABLE_ON_VIDEO( FULLSCREENButton ); } break; case FULLWIDTH_BUTTON: { NORMAL_BUTTON( FULLWIDTH ); } break; case EXTENDED_BUTTON:{ NORMAL_BUTTON( EXTENDED ); } break; case PLAYLIST_BUTTON:{ NORMAL_BUTTON( PLAYLIST ); } break; case SNAPSHOT_BUTTON:{ NORMAL_BUTTON( SNAPSHOT ); ENABLE_ON_VIDEO( SNAPSHOTButton ); } break; case RECORD_BUTTON:{ QToolButton *recordButton = new QToolButton; setupButton( recordButton ); CONNECT_MAP_SET( recordButton, RECORD_ACTION ); BUTTON_SET_BAR( recordButton ); ENABLE_ON_INPUT( recordButton ); recordButton->setCheckable( true ); CONNECT( THEMIM->getIM(), recordingStateChanged( bool ), recordButton, setChecked( bool ) ); widget = recordButton; } break; case ATOB_BUTTON: { AtoB_Button *ABButton = new AtoB_Button; setupButton( ABButton ); ABButton->setShortcut( qtr("Shift+L") ); BUTTON_SET_BAR( ABButton ); ENABLE_ON_INPUT( ABButton ); CONNECT_MAP_SET( ABButton, ATOB_ACTION ); CONNECT( THEMIM->getIM(), AtoBchanged( bool, bool), ABButton, updateButtonIcons( bool, bool ) ); widget = ABButton; } break; case INPUT_SLIDER: { SeekSlider *slider = new SeekSlider( Qt::Horizontal, NULL, !b_shiny ); SeekPoints *chapters = new SeekPoints( this, p_intf ); CONNECT( THEMIM->getIM(), chapterChanged( bool ), chapters, update() ); slider->setChapters( chapters ); /* Update the position when the IM has changed */ CONNECT( THEMIM->getIM(), positionUpdated( float, int64_t, int ), slider, setPosition( float, int64_t, int ) ); /* And update the IM, when the position has changed */ CONNECT( slider, sliderDragged( float ), THEMIM->getIM(), sliderUpdate( float ) ); CONNECT( THEMIM->getIM(), cachingChanged( float ), slider, updateBuffering( float ) ); /* Give hint to disable slider's interactivity when useless */ CONNECT( THEMIM->getIM(), inputCanSeek( bool ), slider, setSeekable( bool ) ); widget = slider; } break; case MENU_BUTTONS: widget = discFrame(); break; case TELETEXT_BUTTONS: widget = telexFrame(); widget->hide(); break; case VOLUME_SPECIAL: b_special = true; case VOLUME: { SoundWidget *snd = new SoundWidget( this, p_intf, b_shiny, b_special ); widget = snd; } break; case TIME_LABEL: { TimeLabel *timeLabel = new TimeLabel( p_intf ); widget = timeLabel; } break; case SPLITTER: { QFrame *line = new QFrame; line->setFrameShape( QFrame::VLine ); line->setFrameShadow( QFrame::Raised ); line->setLineWidth( 0 ); line->setMidLineWidth( 1 ); widget = line; } break; case ADVANCED_CONTROLLER: if( qobject_cast<AdvControlsWidget *>(this) == NULL ) { advControls = new AdvControlsWidget( p_intf, this ); widget = advControls; } break; case REVERSE_BUTTON:{ QToolButton *reverseButton = new QToolButton; setupButton( reverseButton ); CONNECT_MAP_SET( reverseButton, REVERSE_ACTION ); BUTTON_SET_BAR( reverseButton ); reverseButton->setCheckable( true ); /* You should, of COURSE change this to the correct event, when/if we have one, that tells us if trickplay is possible . */ CONNECT( this, inputIsTrickPlayable( bool ), reverseButton, setVisible( bool ) ); reverseButton->setVisible( false ); widget = reverseButton; } break; case SKIP_BACK_BUTTON: { NORMAL_BUTTON( SKIP_BACK ); ENABLE_ON_INPUT( SKIP_BACKButton ); } break; case SKIP_FW_BUTTON: { NORMAL_BUTTON( SKIP_FW ); ENABLE_ON_INPUT( SKIP_FWButton ); } break; case QUIT_BUTTON: { NORMAL_BUTTON( QUIT ); } break; case RANDOM_BUTTON: { NORMAL_BUTTON( RANDOM ); RANDOMButton->setCheckable( true ); RANDOMButton->setChecked( var_GetBool( THEPL, "random" ) ); CONNECT( THEMIM, randomChanged( bool ), RANDOMButton, setChecked( bool ) ); } break; case LOOP_BUTTON:{ LoopButton *loopButton = new LoopButton; setupButton( loopButton ); loopButton->setToolTip( qtr( "Click to toggle between loop all, loop one and no loop") ); loopButton->setCheckable( true ); int i_state = 2 * var_GetBool( THEPL, "loop" ) + var_GetBool( THEPL, "repeat" ); loopButton->updateButtonIcons( i_state ); CONNECT( THEMIM, repeatLoopChanged( int ), loopButton, updateButtonIcons( int ) ); CONNECT( loopButton, clicked(), THEMIM, loopRepeatLoopStatus() ); widget = loopButton; } break; case INFO_BUTTON: { NORMAL_BUTTON( INFO ); } break; case PLAYBACK_BUTTONS:{ widget = new QWidget; DeckButtonsLayout *layout = new DeckButtonsLayout( widget ); BrowseButton *prev = new BrowseButton( widget, BrowseButton::Backward ); BrowseButton *next = new BrowseButton( widget ); RoundButton *play = new RoundButton( widget ); layout->setBackwardButton( prev ); layout->setForwardButton( next ); layout->setRoundButton( play ); CONNECT_MAP_SET( prev, PREVIOUS_ACTION ); CONNECT_MAP_SET( next, NEXT_ACTION ); CONNECT_MAP_SET( play, PLAY_ACTION ); } break; case ASPECT_RATIO_COMBOBOX: widget = new AspectRatioComboBox( p_intf ); widget->setMinimumHeight( 26 ); break; case SPEED_LABEL: widget = new SpeedLabel( p_intf, this ); break; case TIME_LABEL_ELAPSED: widget = new TimeLabel( p_intf, TimeLabel::Elapsed ); break; case TIME_LABEL_REMAINING: widget = new TimeLabel( p_intf, TimeLabel::Remaining ); break; default: msg_Warn( p_intf, "This should not happen %i", button ); break; } /* Customize Buttons */ if( b_flat || b_big ) { QFrame *frame = qobject_cast<QFrame *>(widget); if( frame ) { QList<QToolButton *> allTButtons = frame->findChildren<QToolButton *>(); for( int i = 0; i < allTButtons.count(); i++ ) applyAttributes( allTButtons[i], b_flat, b_big ); } else { QToolButton *tmpButton = qobject_cast<QToolButton *>(widget); if( tmpButton ) applyAttributes( tmpButton, b_flat, b_big ); } } return widget; }
/********************************************************************** * Fullscrenn control widget **********************************************************************/ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWidget *_parent ) : AbstractController( _p_i, _parent ) { RTL_UNAFFECTED_WIDGET i_mouse_last_x = -1; i_mouse_last_y = -1; b_mouse_over = false; i_mouse_last_move_x = -1; i_mouse_last_move_y = -1; #if HAVE_TRANSPARENCY b_slow_hide_begin = false; i_slow_hide_timeout = 1; #endif b_fullscreen = false; i_hide_timeout = 1; i_screennumber = -1; vout.clear(); setWindowFlags( Qt::ToolTip ); setMinimumWidth( FSC_WIDTH ); isWideFSC = false; setFrameShape( QFrame::StyledPanel ); setFrameStyle( QFrame::Sunken ); setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); QVBoxLayout *controlLayout2 = new QVBoxLayout( this ); controlLayout2->setContentsMargins( 4, 6, 4, 2 ); /* First line */ InputControlsWidget *inputC = new InputControlsWidget( p_intf, this ); controlLayout2->addWidget( inputC ); controlLayout = new QHBoxLayout; QString line = getSettings()->value( "MainWindow/FSCtoolbar", FSC_TB_DEFAULT ).toString(); parseAndCreate( line, controlLayout ); controlLayout2->addLayout( controlLayout ); /* hiding timer */ p_hideTimer = new QTimer( this ); p_hideTimer->setSingleShot( true ); CONNECT( p_hideTimer, timeout(), this, hideFSC() ); /* slow hiding timer */ #if HAVE_TRANSPARENCY p_slowHideTimer = new QTimer( this ); CONNECT( p_slowHideTimer, timeout(), this, slowHideFSC() ); f_opacity = var_InheritFloat( p_intf, "qt-fs-opacity" ); #endif i_sensitivity = var_InheritInteger( p_intf, "qt-fs-sensitivity" ); vlc_mutex_init_recursive( &lock ); DCONNECT( THEMIM->getIM(), voutListChanged( vout_thread_t **, int ), this, setVoutList( vout_thread_t **, int ) ); /* First Move */ previousPosition = getSettings()->value( "FullScreen/pos" ).toPoint(); screenRes = getSettings()->value( "FullScreen/screen" ).toRect(); isWideFSC = getSettings()->value( "FullScreen/wide" ).toBool(); i_screennumber = var_InheritInteger( p_intf, "qt-fullscreen-screennumber" ); }
eServiceMP3::eServiceMP3(eServiceReference ref): m_nownext_timer(eTimer::create(eApp)), m_cuesheet_changed(0), m_cutlist_enabled(1), m_ref(ref), m_pump(eApp, 1) { eDebug("[eServiceMP3::%s]", __func__); m_currentAudioStream = -1; m_currentSubtitleStream = -1; m_cachedSubtitleStream = -1; /* report the first subtitle stream to be 'cached'. TODO: use an actual cache. */ m_subtitle_widget = 0; m_buffer_size = 5 * 1024 * 1024; m_cuesheet_loaded = false; /* cuesheet CVR */ inst_m_pump = &m_pump; CONNECT(m_nownext_timer->timeout, eServiceMP3::updateEpgCacheNowNext); CONNECT(inst_m_pump->recv_msg, eServiceMP3::gotThreadMessage); m_aspect = m_width = m_height = m_framerate = m_progressive = -1; m_state = stIdle; instance = this; player = (Context_t*) malloc(sizeof(Context_t)); if (player) { player->playback = &PlaybackHandler; player->output = &OutputHandler; player->container = &ContainerHandler; player->manager = &ManagerHandler; eDebug("[eServiceMP3::%s] %s", __func__, player->output->Name); } //Registration of output devices if (player && player->output) { player->output->Command(player,OUTPUT_ADD, (void*)"audio"); player->output->Command(player,OUTPUT_ADD, (void*)"video"); player->output->Command(player,OUTPUT_ADD, (void*)"subtitle"); } if (player && player->output && player->output->subtitle) { fbClass *fb = fbClass::getInstance(); SubtitleOutputDef_t out; out.screen_width = fb->getScreenResX(); out.screen_height = fb->getScreenResY(); out.shareFramebuffer = 1; out.framebufferFD = fb->getFD(); out.destination = fb->getLFB_Direct(); out.destStride = fb->Stride(); out.framebufferBlit = ep3Blit; player->output->subtitle->Command(player, (OutputCmd_t)OUTPUT_SET_SUBTITLE_OUTPUT, (void*) &out); } //create playback path char file[1023] = {""}; if ((!strncmp("http://", m_ref.path.c_str(), 7)) || (!strncmp("https://", m_ref.path.c_str(), 8)) || (!strncmp("cache://", m_ref.path.c_str(), 8)) || (!strncmp("concat://", m_ref.path.c_str(), 9)) || (!strncmp("crypto://", m_ref.path.c_str(), 9)) || (!strncmp("gopher://", m_ref.path.c_str(), 9)) || (!strncmp("hls://", m_ref.path.c_str(), 6)) || (!strncmp("hls+http://", m_ref.path.c_str(), 11)) || (!strncmp("httpproxy://", m_ref.path.c_str(), 12)) || (!strncmp("mmsh://", m_ref.path.c_str(), 7)) || (!strncmp("mmst://", m_ref.path.c_str(), 7)) || (!strncmp("rtmp://", m_ref.path.c_str(), 7)) || (!strncmp("rtmpe://", m_ref.path.c_str(), 8)) || (!strncmp("rtmpt://", m_ref.path.c_str(), 8)) || (!strncmp("rtmps://", m_ref.path.c_str(), 8)) || (!strncmp("rtmpte://", m_ref.path.c_str(), 9)) || (!strncmp("ftp://", m_ref.path.c_str(), 6)) || (!strncmp("rtp://", m_ref.path.c_str(), 6)) || (!strncmp("srtp://", m_ref.path.c_str(), 7)) || (!strncmp("subfile://", m_ref.path.c_str(), 10)) || (!strncmp("tcp://", m_ref.path.c_str(), 6)) || (!strncmp("tls://", m_ref.path.c_str(), 6)) || (!strncmp("udp://", m_ref.path.c_str(), 6)) || (!strncmp("udplite://", m_ref.path.c_str(), 10))) m_sourceinfo.is_streaming = true; else if ((!strncmp("file://", m_ref.path.c_str(), 7)) || (!strncmp("bluray://", m_ref.path.c_str(), 9)) || (!strncmp("hls+file://", m_ref.path.c_str(), 11)) || (!strncmp("myts://", m_ref.path.c_str(), 7))) ; else strcat(file, "file://"); strcat(file, m_ref.path.c_str()); //try to open file if (player && player->playback && player->playback->Command(player, PLAYBACK_OPEN, file) >= 0) { //VIDEO //We dont have to register video tracks, or do we ? //AUDIO if (player && player->manager && player->manager->audio) { char ** TrackList = NULL; player->manager->audio->Command(player, MANAGER_LIST, &TrackList); if (TrackList != NULL) { eDebug("[eServiceMP3::%s] AudioTrack List:", __func__); int i = 0; for (i = 0; TrackList[i] != NULL; i+=2) { eDebug("[eServiceMP3::%s]\t%s - %s", __func__, TrackList[i], TrackList[i+1]); audioStream audio; audio.language_code = TrackList[i]; // atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFLAC if ( !strncmp("A_MPEG/L3", TrackList[i+1], 9)) audio.type = atMP3; else if (!strncmp("A_MP3", TrackList[i+1], 5)) audio.type = atMP3; else if (!strncmp("A_AC3", TrackList[i+1], 5)) audio.type = atAC3; else if (!strncmp("A_DTS", TrackList[i+1], 5)) audio.type = atDTS; else if (!strncmp("A_AAC", TrackList[i+1], 5)) audio.type = atAAC; else if (!strncmp("A_PCM", TrackList[i+1], 5)) audio.type = atPCM; else if (!strncmp("A_VORBIS", TrackList[i+1], 8)) audio.type = atOGG; else if (!strncmp("A_FLAC", TrackList[i+1], 6)) audio.type = atFLAC; else audio.type = atUnknown; m_audioStreams.push_back(audio); free(TrackList[i]); TrackList[i] = NULL; free(TrackList[i+1]); TrackList[i+1] = NULL; } free(TrackList); TrackList = NULL; } } //SUB if (player && player->manager && player->manager->subtitle) { char ** TrackList = NULL; player->manager->subtitle->Command(player, MANAGER_LIST, &TrackList); if (TrackList != NULL) { eDebug("[eServiceMP3::%s] SubtitleTrack List:", __func__); int i = 0; for (i = 0; TrackList[i] != NULL; i+=2) { eDebug("[eServiceMP3::%s]\t%s - %s", __func__, TrackList[i], TrackList[i+1]); subtitleStream sub; sub.language_code = TrackList[i]; // stPlainText, stSSA, stSRT if ( !strncmp("S_TEXT/SSA", TrackList[i+1], 10) || !strncmp("S_SSA", TrackList[i+1], 5)) sub.type = stSSA; else if (!strncmp("S_TEXT/ASS", TrackList[i+1], 10) || !strncmp("S_AAS", TrackList[i+1], 5)) sub.type = stSSA; else if (!strncmp("S_TEXT/SRT", TrackList[i+1], 10) || !strncmp("S_SRT", TrackList[i+1], 5)) sub.type = stSRT; else sub.type = stPlainText; m_subtitleStreams.push_back(sub); free(TrackList[i]); TrackList[i] = NULL; free(TrackList[i+1]); TrackList[i+1] = NULL; } free(TrackList); TrackList = NULL; } } loadCuesheet(); /* cuesheet CVR */ m_event(this, evStart); } else { //Creation failed, no playback support for insert file, so send e2 EOF to stop playback eDebug("[eServiceMP3::%s] ERROR! Creation failed! No playback support for insert file!", __func__); m_state = stRunning; m_event(this, evEOF); } }
void eOSDExpertSetup::init_eOSDExpertSetup() { cmove(ePoint(170, 115)); int showosd=1; if ( eConfig::getInstance()->getKey("/ezap/osd/showOSDOnSwitchService", showosd) ) eConfig::getInstance()->setKey("/ezap/osd/showOSDOnSwitchService", showosd); list.setFlags(list.getFlags()|eListBoxBase::flagNoPageMovement); timeout_infobar = new eListBoxEntryMulti(&list, _("infobar timeout (left, right)")); timeout_infobar->add((eString)" " + eString().sprintf(_("Infobar timeout %d sec"), 2) + (eString)" >", 2); timeout_infobar->add((eString)"< " + eString().sprintf(_("Infobar timeout %d sec"), 3) + (eString)" >", 3); timeout_infobar->add((eString)"< " + eString().sprintf(_("Infobar timeout %d sec"), 4) + (eString)" >", 4); timeout_infobar->add((eString)"< " + eString().sprintf(_("Infobar timeout %d sec"), 5) + (eString)" >", 5); timeout_infobar->add((eString)"< " + eString().sprintf(_("Infobar timeout %d sec"), 6) + (eString)" >", 6); timeout_infobar->add((eString)"< " + eString().sprintf(_("Infobar timeout %d sec"), 7) + (eString)" >", 7); timeout_infobar->add((eString)"< " + eString().sprintf(_("Infobar timeout %d sec"), 8) + (eString)" >", 8); timeout_infobar->add((eString)"< " + eString().sprintf(_("Infobar timeout %d sec"), 9) + (eString)" >", 9); timeout_infobar->add((eString)"< " + eString().sprintf(_("Infobar timeout %d sec"), 10) + (eString)" >", 10); timeout_infobar->add((eString)"< " + eString().sprintf(_("Infobar timeout %d sec"), 11) + (eString)" >", 11); timeout_infobar->add((eString)"< " + eString().sprintf(_("Infobar timeout %d sec"), 12) + (eString)" ", 12); int timeoutInfobar = 6; eConfig::getInstance()->getKey("/enigma/timeoutInfobar", timeoutInfobar); timeout_infobar->setCurrent(timeoutInfobar); CONNECT( list.selchanged, eOSDExpertSetup::selInfobarChanged ); timeout_volumebar = new eListBoxEntryMulti(&list, _("volumebar timeout (left, right)")); timeout_volumebar->add((eString)" " + eString().sprintf(_("volumebar timeout %d.%d sec"), 0, 5) + (eString)" >", 500); timeout_volumebar->add((eString)"< " + eString().sprintf(_("volumebar timeout %d.%d sec"), 1, 0) + (eString)" >", 1000); timeout_volumebar->add((eString)"< " + eString().sprintf(_("volumebar timeout %d.%d sec"), 1, 5) + (eString)" >", 1500); timeout_volumebar->add((eString)"< " + eString().sprintf(_("volumebar timeout %d.%d sec"), 2, 0) + (eString)" >", 2000); timeout_volumebar->add((eString)"< " + eString().sprintf(_("volumebar timeout %d.%d sec"), 2, 5) + (eString)" >", 2500); timeout_volumebar->add((eString)"< " + eString().sprintf(_("volumebar timeout %d.%d sec"), 3, 0) + (eString)" >", 3000); timeout_volumebar->add((eString)"< " + eString().sprintf(_("volumebar timeout %d.%d sec"), 3, 5) + (eString)" >", 3500); timeout_volumebar->add((eString)"< " + eString().sprintf(_("volumebar timeout %d.%d sec"), 4, 0) + (eString)" >", 4000); timeout_volumebar->add((eString)"< " + eString().sprintf(_("volumebar timeout %d.%d sec"), 4, 5) + (eString)" >", 4500); timeout_volumebar->add((eString)"< " + eString().sprintf(_("volumebar timeout %d.%d sec"), 5, 0) + (eString)" >", 5000); timeout_volumebar->add((eString)"< " + eString().sprintf(_("volumebar timeout %d.%d sec"), 5, 5) + (eString)" >", 5500); timeout_volumebar->add((eString)"< " + eString().sprintf(_("volumebar timeout %d.%d sec"), 6, 0) + (eString)" ", 6000); int timeoutVolumebar = 2000; eConfig::getInstance()->getKey("/enigma/timeoutVolumebar", timeoutVolumebar); timeout_volumebar->setCurrent(timeoutVolumebar); CONNECT( list.selchanged, eOSDExpertSetup::selVolumebarChanged ); timeout_keypressed = new eListBoxEntryMulti(&list, _("channel numbers timeout (left, right)")); timeout_keypressed->add((eString)" " + eString().sprintf(_("keypressed timeout %d.%d sec"), 0, 5) + (eString)" >", 500); timeout_keypressed->add((eString)"< " + eString().sprintf(_("keypressed timeout %d.%d sec"), 1, 0) + (eString)" >", 1000); timeout_keypressed->add((eString)"< " + eString().sprintf(_("keypressed timeout %d.%d sec"), 1, 5) + (eString)" >", 1500); timeout_keypressed->add((eString)"< " + eString().sprintf(_("keypressed timeout %d.%d sec"), 2, 0) + (eString)" >", 2000); timeout_keypressed->add((eString)"< " + eString().sprintf(_("keypressed timeout %d.%d sec"), 2, 5) + (eString)" >", 2500); timeout_keypressed->add((eString)"< " + eString().sprintf(_("keypressed timeout %d.%d sec"), 3, 0) + (eString)" >", 3000); timeout_keypressed->add((eString)"< " + eString().sprintf(_("keypressed timeout %d.%d sec"), 3, 5) + (eString)" >", 3500); timeout_keypressed->add((eString)"< " + eString().sprintf(_("keypressed timeout %d.%d sec"), 4, 0) + (eString)" >", 4000); timeout_keypressed->add((eString)"< " + eString().sprintf(_("keypressed timeout %d.%d sec"), 4, 5) + (eString)" >", 4500); timeout_keypressed->add((eString)"< " + eString().sprintf(_("keypressed timeout %d.%d sec"), 5, 0) + (eString)" >", 5000); timeout_keypressed->add((eString)"< " + eString().sprintf(_("keypressed timeout %d.%d sec"), 5, 5) + (eString)" >", 5500); timeout_keypressed->add((eString)"< " + eString().sprintf(_("keypressed timeout %d.%d sec"), 6, 0) + (eString)" ", 6000); int timeoutKeypressed = 2000; eConfig::getInstance()->getKey("/enigma/channelKeypressedInitDelay", timeoutKeypressed); timeout_keypressed->setCurrent(timeoutKeypressed); CONNECT( list.selchanged, eOSDExpertSetup::selChannelKeypressedInitDelayChanged ); new eListBoxEntryCheck(&list, _("show infobar on service switch"), "/ezap/osd/showOSDOnSwitchService", _("show infobar when switching to another service")); CONNECT((new eListBoxEntryCheck(&list,_("Serviceselector help buttons"),"/ezap/serviceselector/showButtons",_("show colored help buttons in service selector")))->selected, eOSDExpertSetup::colorbuttonsChanged ); if ( eSystemInfo::getInstance()->getFEType() == eSystemInfo::feSatellite) new eListBoxEntryCheck(&list, _("Show Sat position"), "/extras/showSatPos", _("show sat position in the infobar")); new eListBoxEntryCheck(&list, _("Skip confirmations"), "/elitedvb/extra/profimode", _("enable/disable confirmations")); new eListBoxEntryCheck(&list, _("Hide error windows"), "/elitedvb/extra/hideerror", _("don't show zap error messages")); new eListBoxEntryCheck(&list, _("Auto show Infobar"), "/ezap/osd/showOSDOnEITUpdate", _("always show infobar when new event info is avail")); new eListBoxEntryCheck(&list, _("Show remaining Time"), "/ezap/osd/showCurrentRemaining", _("show event remaining time in the infobar")); new eListBoxEntryCheck(&list, _("Hide shortcut icons"), "/ezap/osd/hideshortcuts", _("hide shortcut icons in menus")); }
PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) : QWidget( _par ), p_intf ( _p_i ) { setContentsMargins( 0, 3, 0, 3 ); QGridLayout *layout = new QGridLayout( this ); layout->setMargin( 0 ); layout->setSpacing( 0 ); /******************* * Left * *******************/ /* We use a QSplitter for the left part */ leftSplitter = new QSplitter( Qt::Vertical, this ); /* Source Selector */ selector = new PLSelector( this, p_intf ); leftSplitter->addWidget( selector ); /* Create a Container for the Art Label in order to have a beautiful resizing for the selector above it */ artContainer = new QStackedWidget; artContainer->setMaximumHeight( 256 ); /* Art label */ CoverArtLabel *art = new CoverArtLabel( artContainer, p_intf ); art->setToolTip( qtr( "Double click to get media information" ) ); artContainer->addWidget( art ); CONNECT( THEMIM->getIM(), artChanged( QString ), art, showArtUpdate( const QString& ) ); CONNECT( THEMIM->getIM(), artChanged( input_item_t * ), art, showArtUpdate( input_item_t * ) ); leftSplitter->addWidget( artContainer ); /******************* * Right * *******************/ /* Initialisation of the playlist */ playlist_t * p_playlist = THEPL; PL_LOCK; playlist_item_t *p_root = p_playlist->p_playing; PL_UNLOCK; setMinimumWidth( 400 ); PLModel *model = PLModel::getPLModel( p_intf ); #ifdef MEDIA_LIBRARY MLModel *mlmodel = new MLModel( p_intf, this ); mainView = new StandardPLPanel( this, p_intf, p_root, selector, model, mlmodel ); #else mainView = new StandardPLPanel( this, p_intf, p_root, selector, model, NULL ); #endif /* Location Bar */ locationBar = new LocationBar( model ); locationBar->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred ); layout->addWidget( locationBar, 0, 0, 1, 2 ); layout->setColumnStretch( 0, 5 ); CONNECT( locationBar, invoked( const QModelIndex & ), mainView, browseInto( const QModelIndex & ) ); QHBoxLayout *topbarLayout = new QHBoxLayout(); layout->addLayout( topbarLayout, 0, 1 ); topbarLayout->setSpacing( 10 ); /* Button to switch views */ QToolButton *viewButton = new QToolButton( this ); viewButton->setIcon( style()->standardIcon( QStyle::SP_FileDialogDetailedView ) ); viewButton->setToolTip( qtr("Change playlistview") ); topbarLayout->addWidget( viewButton ); viewButton->setMenu( StandardPLPanel::viewSelectionMenu( mainView )); CONNECT( viewButton, clicked(), mainView, cycleViews() ); /* Search */ searchEdit = new SearchLineEdit( this ); searchEdit->setMaximumWidth( 250 ); searchEdit->setMinimumWidth( 80 ); searchEdit->setToolTip( qtr("Search the playlist") ); topbarLayout->addWidget( searchEdit ); CONNECT( searchEdit, textChanged( const QString& ), mainView, search( const QString& ) ); CONNECT( searchEdit, searchDelayedChanged( const QString& ), mainView, searchDelayed( const QString & ) ); CONNECT( mainView, viewChanged( const QModelIndex& ), this, changeView( const QModelIndex &) ); /* Connect the activation of the selector to a redefining of the PL */ DCONNECT( selector, categoryActivated( playlist_item_t *, bool ), mainView, setRootItem( playlist_item_t *, bool ) ); mainView->setRootItem( p_root, false ); CONNECT( selector, SDCategorySelected(bool), mainView, setWaiting(bool) ); /* */ split = new PlaylistSplitter( this ); /* Add the two sides of the QSplitter */ split->addWidget( leftSplitter ); split->addWidget( mainView ); QList<int> sizeList; sizeList << 180 << 420 ; split->setSizes( sizeList ); split->setStretchFactor( 0, 0 ); split->setStretchFactor( 1, 3 ); split->setCollapsible( 1, false ); leftSplitter->setMaximumWidth( 250 ); /* In case we want to keep the splitter information */ // components shall never write there setting to a fixed location, may infer // with other uses of the same component... getSettings()->beginGroup("Playlist"); split->restoreState( getSettings()->value("splitterSizes").toByteArray()); leftSplitter->restoreState( getSettings()->value("leftSplitterGeometry").toByteArray() ); getSettings()->endGroup(); layout->addWidget( split, 1, 0, 1, -1 ); setAcceptDrops( true ); setWindowTitle( qtr( "Playlist" ) ); setWindowRole( "vlc-playlist" ); setWindowIcon( QApplication::windowIcon() ); }
void enigmaCIMMI::beginExec() { conn = CONNECT(ci->ci_mmi_progress, enigmaMMI::gotMMIData ); }
void enigmaCI::init_enigmaCI() { CONNECT(ci_messages.recv_msg, enigmaCI::updateCIinfo ); int fd=eSkin::getActive()->queryValue("fontsize", 20); DVBCI=eDVB::getInstance()->DVBCI; if( eSystemInfo::getInstance()->hasCI() > 1 ) { setText(_("Common Interface Modules")); move(ePoint(160, 90)); cresize(eSize(350, 330)); DVBCI2=eDVB::getInstance()->DVBCI2; CONNECT(ci2_messages.recv_msg, enigmaCI::updateCI2info ); } else { setText(_("Common Interface Module")); move(ePoint(160, 120)); cresize(eSize(350, 250)); } reset=new eButton(this); reset->setText(_("Reset")); reset->move(ePoint(10, 13)); reset->resize(eSize(330, fd+10)); reset->setHelpText(_("reset the Common Interface module")); reset->loadDeco(); CONNECT(reset->selected, enigmaCI::resetPressed); init=new eButton(this); init->setText(_("Init")); init->move(ePoint(10, 53)); init->resize(eSize(330, fd+10)); init->setHelpText(_("send the ca-pmt to CI")); init->loadDeco(); CONNECT(init->selected, enigmaCI::initPressed); app=new eButton(this); app->setText(_("waiting for module")); app->move(ePoint(10, 93)); app->resize(eSize(330, fd+10)); app->setHelpText(_("enter Common Interface menu (mmi)")); app->loadDeco(); CONNECT(app->selected, enigmaCI::appPressed); if( eSystemInfo::getInstance()->hasCI() > 1 ) { reset2=new eButton(this); reset2->setText(_("Reset")); reset2->move(ePoint(10, 143)); reset2->resize(eSize(330, fd+10)); reset2->setHelpText(_("reset the Common Interface module")); reset2->loadDeco(); CONNECT(reset2->selected, enigmaCI::reset2Pressed); init2=new eButton(this); init2->setText(_("Init")); init2->move(ePoint(10, 183)); init2->resize(eSize(330, fd+10)); init2->setHelpText(_("send the ca-pmt to CI")); init2->loadDeco(); CONNECT(init2->selected, enigmaCI::init2Pressed); app2=new eButton(this); app2->setText(_("waiting for module")); app2->move(ePoint(10, 223)); app2->resize(eSize(330, fd+10)); app2->setHelpText(_("enter Common Interface menu (mmi)")); app2->loadDeco(); CONNECT(app2->selected, enigmaCI::app2Pressed); } else { int handleTwo=0; eConfig::getInstance()->getKey("/ezap/ci/handleTwoServices", handleTwo); twoServices = new eCheckbox(this); twoServices->move(ePoint(10,128)); twoServices->resize(eSize(330,(fd+10)*2)); twoServices->setCheck(handleTwo); twoServices->setFlags(RS_WRAP|eLabel::flagVCenter); twoServices->setText(_("can handle two services")); twoServices->setHelpText(_("can your CI descramble two services at the same time?")); CONNECT(twoServices->checked, enigmaCI::handleTwoServicesChecked); } status = new eStatusBar(this); status->move( ePoint(0, clientrect.height()-50) ); status->resize( eSize( clientrect.width(), 50) ); status->loadDeco(); CONNECT(DVBCI->ci_progress, enigmaCI::gotCIinfoText); DVBCI->messages.send(eDVBCI::eDVBCIMessage(eDVBCI::eDVBCIMessage::getAppName)); if( eSystemInfo::getInstance()->hasCI() > 1 ) { CONNECT(DVBCI2->ci_progress, enigmaCI::gotCI2infoText); DVBCI2->messages.send(eDVBCI::eDVBCIMessage(eDVBCI::eDVBCIMessage::getAppName)); } }
void eTOnlineDialog::init_eTOnlineDialog(eString Login) { setText("T - Online"); cmove(ePoint(140,140)); cresize(eSize(450,270)); eLabel *l = new eLabel(this); l->move(ePoint(10,10)); l->resize(eSize(220,30)); l->setText("Anschlusskennung:"); Kennung = new eTextInputField(this,l); Kennung->move(ePoint(230,10)); Kennung->resize(eSize(200,35)); Kennung->setMaxChars(12); Kennung->setUseableChars("1234567890"); Kennung->loadDeco(); Kennung->setHelpText("Anschlusskennung eingeben mit OK (12 Stellen)"); Kennung->setEditHelpText("Anschlusskennung eingeben (0..9, ok)"); l = new eLabel(this); l->move(ePoint(10,60)); l->resize(eSize(220,30)); l->setText("T-Online Nummer:"); tOnlineNummer = new eTextInputField(this,l); tOnlineNummer->move(ePoint(230,60)); tOnlineNummer->resize(eSize(200,35)); tOnlineNummer->setMaxChars(12); tOnlineNummer->setUseableChars("1234567890"); tOnlineNummer->loadDeco(); tOnlineNummer->setHelpText("T-Online Nummer eingeben mit OK (12 Stellen)"); tOnlineNummer->setEditHelpText("T-Online Nummer eingeben (0..9, ok)"); l = new eLabel(this); l->move(ePoint(10,110)); l->resize(eSize(220,30)); l->setText("Mitbenutzernummer:"); Mitbenutzer = new eTextInputField(this,l); Mitbenutzer->move(ePoint(230,110)); Mitbenutzer->resize(eSize(70,35)); Mitbenutzer->setMaxChars(4); Mitbenutzer->setUseableChars("1234567890"); Mitbenutzer->loadDeco(); Mitbenutzer->setHelpText("Mitbenutzernummer eingeben mit OK (4 Stellen)"); Mitbenutzer->setEditHelpText("Mitbenutzernummer eingeben (0..9, ok)"); ok = new eButton(this); ok->move(ePoint(10,160)); ok->resize(eSize(170,40)); ok->setShortcut("green"); ok->setShortcutPixmap("green"); ok->setText("speichern"); ok->setHelpText("Daten übernehmen und Fenster schliessen"); ok->loadDeco(); CONNECT(ok->selected, eWidget::accept); sbar = new eStatusBar(this); sbar->move( ePoint(0, clientrect.height()-50) ); sbar->resize( eSize( clientrect.width(), 50) ); sbar->loadDeco(); if (Login) { unsigned int pos1 = Login.find("#"), pos2 = Login.find("@"); if ( pos1 != eString::npos && pos2 != eString::npos ) { Kennung->setText(Login.left(12)); tOnlineNummer->setText(Login.mid(12,12)); Mitbenutzer->setText(Login.mid(pos1+1,4)); } } }
void eDVBResourceManager::addAdapter(iDVBAdapter *adapter) { int num_fe = adapter->getNumFrontends(); int num_demux = adapter->getNumDemux(); m_adapter.push_back(adapter); int i; for (i=0; i<num_demux; ++i) { ePtr<eDVBDemux> demux; if (!adapter->getDemux(demux, i)) m_demux.push_back(new eDVBRegisteredDemux(demux, adapter)); } ePtr<eDVBRegisteredFrontend> prev_dvbt_frontend; for (i=0; i<num_fe; ++i) { ePtr<eDVBFrontend> frontend; if (!adapter->getFrontend(frontend, i)) { int frontendType=0; frontend->getFrontendType(frontendType); eDVBRegisteredFrontend *new_fe = new eDVBRegisteredFrontend(frontend, adapter); CONNECT(new_fe->stateChanged, eDVBResourceManager::feStateChanged); m_frontend.push_back(new_fe); frontend->setSEC(m_sec); // we must link all dvb-t frontends ( for active antenna voltage ) if (frontendType == iDVBFrontend::feTerrestrial) { if (prev_dvbt_frontend) { prev_dvbt_frontend->m_frontend->setData(eDVBFrontend::LINKED_NEXT_PTR, (long)new_fe); frontend->setData(eDVBFrontend::LINKED_PREV_PTR, (long)&(*prev_dvbt_frontend)); } prev_dvbt_frontend = new_fe; } } } prev_dvbt_frontend = 0; for (i=0; i<num_fe; ++i) { ePtr<eDVBFrontend> frontend; if (!adapter->getFrontend(frontend, i, true)) { int frontendType=0; frontend->getFrontendType(frontendType); eDVBRegisteredFrontend *new_fe = new eDVBRegisteredFrontend(frontend, adapter); // CONNECT(new_fe->stateChanged, eDVBResourceManager::feStateChanged); m_simulate_frontend.push_back(new_fe); frontend->setSEC(m_sec); // we must link all dvb-t frontends ( for active antenna voltage ) if (frontendType == iDVBFrontend::feTerrestrial) { if (prev_dvbt_frontend) { prev_dvbt_frontend->m_frontend->setData(eDVBFrontend::LINKED_NEXT_PTR, (long)new_fe); frontend->setData(eDVBFrontend::LINKED_PREV_PTR, (long)&(*prev_dvbt_frontend)); } prev_dvbt_frontend = new_fe; } } } }
void eNFSSetup::init_eNFSSetup() { bool have_cifs=false; bool have_smbfs=false; FILE *f=fopen("/proc/filesystems", "rt"); if (f) { while (1) { char buffer[128]; if (!fgets(buffer, 128, f)) break; if ( strstr(buffer, "cifs") ) have_cifs=true; if ( strstr(buffer, "smbfs") ) have_smbfs=true; } fclose(f); } CONNECT(timeout.timeout, eNFSSetup::mountTimeout); __u32 sip=ntohl(0x0a000061); int de[4]; lip = CreateSkinnedLabel("lip"); eNumber::unpack(sip, de); ip=CreateSkinnedNumber("ip",0, 4, 0, 255, 3, de, 0, lip); ip->setFlags(eNumber::flagDrawPoints); CONNECT(ip->selected, eNFSSetup::fieldSelected); combo_fstype=CreateSkinnedComboBox("combo_fstype", 2); new eListBoxEntryText( *combo_fstype, "NFS", (void*)0, 0, "Network File System"); if (have_cifs) new eListBoxEntryText( *combo_fstype, "CIFS", (void*)1, 0, "Common Internet File System"); if (have_smbfs) new eListBoxEntryText( *combo_fstype, "SMBFS", (void*)2, 0, _("Samba File System(to mount share from another Dreambox)")); combo_fstype->setCurrent(0,true); CONNECT(combo_fstype->selchanged, eNFSSetup::fstypeChanged); lsdir = CreateSkinnedLabel("lsdir"); sdir = CreateSkinnedTextInputField("sdir",0); sdir->setUseableChars("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.,:|!?/"); lldir = CreateSkinnedLabel("lldir"); ldir = CreateSkinnedTextInputField("ldir",0); ldir->setUseableChars("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.,:|!?/"); loptions = CreateSkinnedLabel("lcombo_options"); combo_options=CreateSkinnedComboBox("combo_options", 3, loptions); new eListBoxEntryText( *combo_options, "", (void*)0, 0); new eListBoxEntryText( *combo_options, "ro", (void*)1, 0); new eListBoxEntryText( *combo_options, "rw", (void*)2, 0); new eListBoxEntryText( *combo_options, "ro,nolock", (void*)3, 0); new eListBoxEntryText( *combo_options, "rw,nolock", (void*)4, 0); new eListBoxEntryText( *combo_options, "ro,soft", (void*)5, 0); new eListBoxEntryText( *combo_options, "rw,soft", (void*)6, 0); new eListBoxEntryText( *combo_options, "ro,soft,nolock", (void*)7, 0); new eListBoxEntryText( *combo_options, "rw,soft,nolock", (void*)8, 0); new eListBoxEntryText( *combo_options, "ro,udp,nolock", (void*)9, 0); new eListBoxEntryText( *combo_options, "rw,udp,nolock", (void*)10, 0); new eListBoxEntryText( *combo_options, "ro,soft,udp", (void*)11, 0); new eListBoxEntryText( *combo_options, "rw,soft,udp", (void*)12, 0); new eListBoxEntryText( *combo_options, "ro,soft,udp,nolock", (void*)13, 0); new eListBoxEntryText( *combo_options, "rw,soft,udp,nolock", (void*)14, 0); combo_options->setCurrent(0,true); lextras = CreateSkinnedLabel("lextraoptions"); extraoptions=CreateSkinnedTextInputField("extraoptions",0); extraoptions->setMaxChars(100); luser = CreateSkinnedLabel("luser"); user=CreateSkinnedTextInputField("user",0); user->setMaxChars(100); lpass = CreateSkinnedLabel("lpass"); pass=CreateSkinnedTextInputField("pass",0); pass->setMaxChars(100); doamount=CreateSkinnedCheckbox("doamount"); //buttons prev = CreateSkinnedButton("prev"); CONNECT(prev->selected, eNFSSetup::prevPressed); CONNECT(CreateSkinnedButton("umount")->selected, eNFSSetup::umountPressed); CONNECT(CreateSkinnedButton("mount")->selected, eNFSSetup::mountPressed); CONNECT(CreateSkinnedButton("ok")->selected, eNFSSetup::okPressed); next = CreateSkinnedButton("next"); CONNECT(next->selected, eNFSSetup::nextPressed); BuildSkin("eNFSSetup"); cur_entry=0; headline.sprintf("Mount Manager(%d/%d)",cur_entry + 1, MAX_NFS_ENTRIES); setText(headline); load_config(); }
RESULT eDVBResourceManager::allocateChannel(const eDVBChannelID &channelid, eUsePtr<iDVBChannel> &channel, bool simulate) { /* first, check if a channel is already existing. */ std::list<active_channel> &active_channels = simulate ? m_active_simulate_channels : m_active_channels; if (!simulate && m_cached_channel) { eDVBChannel *cache_chan = (eDVBChannel*)&(*m_cached_channel); if(channelid==cache_chan->getChannelID()) { eDebug("use cached_channel"); channel = m_cached_channel; return 0; } m_cached_channel_state_changed_conn.disconnect(); m_cached_channel=0; m_releaseCachedChannelTimer->stop(); } eDebugNoSimulate("allocate channel.. %04x:%04x", channelid.transport_stream_id.get(), channelid.original_network_id.get()); for (std::list<active_channel>::iterator i(active_channels.begin()); i != active_channels.end(); ++i) { eDebugNoSimulate("available channel.. %04x:%04x", i->m_channel_id.transport_stream_id.get(), i->m_channel_id.original_network_id.get()); if (i->m_channel_id == channelid) { eDebugNoSimulate("found shared channel.."); channel = i->m_channel; return 0; } } /* no currently available channel is tuned to this channelid. create a new one, if possible. */ if (!m_list) { eDebugNoSimulate("no channel list set!"); return errNoChannelList; } ePtr<iDVBFrontendParameters> feparm; if (m_list->getChannelFrontendData(channelid, feparm)) { eDebugNoSimulate("channel not found!"); return errChannelNotInList; } /* allocate a frontend. */ ePtr<eDVBAllocatedFrontend> fe; int err = allocateFrontend(fe, feparm, simulate); if (err) return err; RESULT res; ePtr<eDVBChannel> ch = new eDVBChannel(this, fe); res = ch->setChannel(channelid, feparm); if (res) { channel = 0; return errChidNotFound; } if (simulate) channel = ch; else { m_cached_channel = channel = ch; m_cached_channel_state_changed_conn = CONNECT(ch->m_stateChanged,eDVBResourceManager::DVBChannelStateChanged); } return 0; }
void frmViewCtrl::Init(){ viewctrl = dv->viewctrl.get(); lights = dv->lights.get(); CONNECT(ui->backgrnd,frmViewCtrl::backgrnd); CONNECT(ui->showtool,frmViewCtrl::showtool); CONNECT(ui->drawsimple,frmViewCtrl::drawsimple); CONNECT(ui->orthoprojection,frmViewCtrl::orthoprojection); CONNECT(ui->zoom_plus,frmViewCtrl::zoom_plus); CONNECT(ui->zoom_minus,frmViewCtrl::zoom_minus); CONNECT(ui->animmethod,frmViewCtrl::animmethod); CONNECT(ui->animstart,frmViewCtrl::anim_start); CONNECT(ui->light1,frmViewCtrl::light1); CONNECT(ui->light2,frmViewCtrl::light2); CONNECT(ui->reset,frmViewCtrl::reset); }
void eServiceHandlerDVB::init_eServiceHandlerDVB() { if (eServiceInterface::getInstance()->registerHandler(id, this)<0) eFatal("couldn't register serviceHandler %d", id); CONNECT(eDVB::getInstance()->scrambled, eServiceHandlerDVB::scrambledStatusChanged); CONNECT(eDVB::getInstance()->switchedService, eServiceHandlerDVB::switchedService); CONNECT(eDVB::getInstance()->gotEIT, eServiceHandlerDVB::gotEIT); CONNECT(eDVB::getInstance()->gotSDT, eServiceHandlerDVB::gotSDT); CONNECT(eDVB::getInstance()->gotPMT, eServiceHandlerDVB::gotPMT); CONNECT(eDVB::getInstance()->leaveService, eServiceHandlerDVB::leaveService); #ifndef DISABLE_FILE CONNECT(eDVB::getInstance()->eventOccured, eServiceHandlerDVB::handleDVBEvent); #endif CONNECT(eStreamWatchdog::getInstance()->AspectRatioChanged, eServiceHandlerDVB::aspectRatioChanged); int data = 0xFFFFFFFF; data &= ~(1<<4); // exclude NVOD data &= ~(1<<1); // exclude TV data &= ~(1<<2); // exclude Radio cache.addPersistentService( eServiceReference(eServiceReference::idDVB, eServiceReference::flagDirectory|eServiceReference::shouldSort, -1, (1<<4)|(1<<1), 0xFFFFFFFF), new eService( eString().sprintf("%s (%s)",_("Providers"),_("TV"))) ); cache.addPersistentService( eServiceReference(eServiceReference::idDVB, eServiceReference::flagDirectory|eServiceReference::shouldSort, -1, 1<<2, 0xFFFFFFFF ), new eService( eString().sprintf("%s (%s)",_("Providers"),_("Radio"))) ); cache.addPersistentService( eServiceReference(eServiceReference::idDVB, eServiceReference::flagDirectory|eServiceReference::shouldSort, -1, data, 0xFFFFFFFF), new eService( eString().sprintf("%s (%s)",_("Providers"),_("Data"))) ); cache.addPersistentService( eServiceReference(eServiceReference::idDVB, eServiceReference::flagDirectory|eServiceReference::shouldSort, -2, (1<<4)|(1<<1), 0xFFFFFFFF ), // TV and NVOD new eService( eString().sprintf("%s (%s)",_("All services"),_("TV"))) ); cache.addPersistentService( eServiceReference(eServiceReference::idDVB, eServiceReference::flagDirectory|eServiceReference::shouldSort, -2, 1<<2, 0xFFFFFFFF ), // radio new eService( eString().sprintf("%s (%s)",_("All services"),_("Radio"))) ); cache.addPersistentService( eServiceReference(eServiceReference::idDVB, eServiceReference::flagDirectory|eServiceReference::shouldSort, -2, data, 0xFFFFFFFF), new eService( eString().sprintf("%s (%s)",_("All services"),_("Data"))) ); if ( eSystemInfo::getInstance()->getFEType() == eSystemInfo::feSatellite ) { cache.addPersistentService( eServiceReference(eServiceReference::idDVB, eServiceReference::flagDirectory|eServiceReference::shouldSort, -4, (1<<4)|(1<<1)), new eService( eString().sprintf("%s (%s)",_("Satellites"),_("TV"))) ); cache.addPersistentService( eServiceReference(eServiceReference::idDVB, eServiceReference::flagDirectory|eServiceReference::shouldSort, -4, 1<<2), new eService( eString().sprintf("%s (%s)",_("Satellites"),_("Radio"))) ); cache.addPersistentService( eServiceReference(eServiceReference::idDVB, eServiceReference::flagDirectory|eServiceReference::shouldSort, -4, data), new eService( eString().sprintf("%s (%s)",_("Satellites"),_("Data"))) ); } #ifndef DISABLE_FILE CONNECT(eServiceFileHandler::getInstance()->fileHandlers, eServiceHandlerDVB::addFile); recording=0; CONNECT(messages.recv_msg, eServiceHandlerDVB::gotMessage); #endif }
void eSatfind::init_eSatfind() { p_snr=new eProgress(this); p_snr->setName("snr"); p_agc=new eProgress(this); p_agc->setName("agc"); p_ber=new eProgress(this); p_ber->setName("ber"); c_sync=new eCheckbox(this, 0, 0); c_sync->setName("sync"); c_lock=new eCheckbox(this, 0, 0); c_lock->setName("lock"); lsnr_num=new eLabel(this); lsnr_num->setName("snr_num"); lsync_num=new eLabel(this); lsync_num->setName("agc_num"); lber_num=new eLabel(this); lber_num->setName("ber_num"); sat = new eComboBox(this, 3); sat->setName("sat"); CONNECT(sat->selchanged, eSatfind::satChanged ); transponder = new eComboBox(this, 5); transponder->setName("transponder"); CONNECT(updateTimer.timeout, eSatfind::update); eLabel *l = new eLabel(this); l->setName("lSat"); if (eSkin::getActive()->build(this, "eSatfind")) return; eDVBServiceController *sapi=eDVB::getInstance()->getServiceAPI(); if (sapi && sapi->transponder) current = sapi->transponder; eListBoxEntryText *sel=0; if ( eSystemInfo::getInstance()->getFEType() == eSystemInfo::feTerrestrial ) { setText(_("Signalfind")); l->setText(_("Region:")); } std::map<int,eSatellite*> sats; for ( std::list<eLNB>::iterator it( eTransponderList::getInstance()->getLNBs().begin() ); it != eTransponderList::getInstance()->getLNBs().end(); it++) for ( ePtrList<eSatellite>::iterator s ( it->getSatelliteList().begin() ); s != it->getSatelliteList().end(); s++) sats[s->getOrbitalPosition()]=s; for ( std::list<tpPacket>::const_iterator i(eTransponderList::getInstance()->getNetworks().begin()); i != eTransponderList::getInstance()->getNetworks().end(); ++i) if ( ( sats.find(i->orbital_position) != sats.end()) || (eSystemInfo::getInstance()->getFEType() != eSystemInfo::feSatellite) ) { if ( eSystemInfo::getInstance()->getFEType() == eSystemInfo::feSatellite && current && i->orbital_position == current->satellite.orbital_position ) sel = new eListBoxEntryText(*sat, i->name, (void*)&*i); else new eListBoxEntryText(*sat, i->name, (void*)&*i); } if ( sat->getCount() ) { if ( sel ) sat->setCurrent(sel,true); else sat->setCurrent(0,true); } CONNECT( eFrontend::getInstance()->s_RotorRunning, eSatfind::RotorRunning ); CONNECT( eFrontend::getInstance()->tunedIn, eSatfind::tunedIn ); CONNECT(transponder->selchanged, eSatfind::tpChanged); /* help text for satfinder screen */ setHelpText(_("\tSatFind\n\n>>> [MENU] >>> [6] Setup\n>>> Service Searching >>> SatFind\n. . . . . . . . . .\n\n" \ "Here you can see the quality of the signal your receiver is getting from your dish/lnb(s).\n. . . . . . . . . .\n\n" \ "Usage:\n\nSNR\tSignal to Noise Ratio\n\nAGC\tAutomatic Gain Control\n\nBER\tBit Error Rate\n\n" \ "SATTELITE\tSelect satellite to monitor\n\nTRANSPONDER\tSelect transponder to monitor\n\n[OK]/[EXIT]\tClose window")); }
void eDVRPlayerThread::init_eDVRPlayerThread(const char *_filename) { state=stateInit; int nodetect=0; eConfig::getInstance()->getKey("/enigma/notimestampdetect", nodetect ); timestampParser = nodetect ? 0 : new eTimeStampParserTS(_filename); int count=0; seekbusy=0; seeking=0; #if HAVE_DVB_API_VERSION < 3 do { dvrfd=::open("/dev/pvr", O_WRONLY|O_NONBLOCK); // TODO: change to /dev/dvb/dvr0 (but only when drivers support this!) if (dvrfd < 0) { if ( errno == EBUSY ) { eDebug("pvr device busy try %d", count++); if ( count < 40 ) { usleep(20000); continue; } } eDebug("couldn't open /dev/pvr - buy the new $$$ box and load pvr.o! (%m)"); state=stateError; } break; } while( dvrfd < 0 ); #else if ((dvrfd = ::open("/dev/dvb/adapter0/dvr0", O_WRONLY|O_NONBLOCK)) == -1) { eDebug("couldn't open /dev/dvb/adapter0/dvr0 (%m)"); state=stateError; } #endif outputsn=new eSocketNotifier(this, dvrfd, eSocketNotifier::Write, 0); CONNECT(outputsn->activated, eDVRPlayerThread::outputReady); CONNECT(liveupdatetimer.timeout, eDVRPlayerThread::updatePosition); filename=_filename; sourcefd=-1; inputsn=0; slice=0; audiotracks=1; if (playingPermanentTimeshift) { filelength = permanentTimeshift.getCurrentLength (-1)/1880; } else { filelength = FillSliceSizes(); } if (openFile(0)) { state=stateError; eDebug("error opening %s (%m)", filename.c_str()); } CONNECT(messages.recv_msg, eDVRPlayerThread::gotMessage); if ( eSystemInfo::getInstance()->getHwType() < 3 ) // dbox2 maxBufferFullness=128*1024; else maxBufferFullness=256*1024; speed=1; run(); if (livemode) { int fileend; if (filelength > (TIMESHIFT_GUARD/1880)) fileend = filelength - (TIMESHIFT_GUARD/1880); else fileend = 0; if ( livemode == 1 ) messages.send(eDVRPlayerThread::eDVRPlayerThreadMessage(eDVRPlayerThread::eDVRPlayerThreadMessage::seekreal, fileend)); } FILE *bitstream=fopen("/proc/bus/bitstream", "rt"); if (bitstream) { char buf[100]; while (fgets(buf, 100, bitstream)) { if (strstr(buf, "AUDIO_STC:")) { needasyncworkaround=1; break; } } fclose(bitstream); } }
static void connect_to_test_case (CutRunContext *context, CutTestCase *test_case) { #define CONNECT(name) \ g_signal_connect(test_case, #name, \ G_CALLBACK(cb_ ## name ## _test_case), context) CONNECT(start_test); CONNECT(complete_test); CONNECT(start_test_iterator); CONNECT(complete_test_iterator); CONNECT(success); CONNECT(failure); CONNECT(error); CONNECT(pending); CONNECT(notification); CONNECT(omission); CONNECT(crash); CONNECT(failure_in); CONNECT(error_in); CONNECT(pending_in); CONNECT(notification_in); CONNECT(omission_in); CONNECT(crash_in); CONNECT(ready); CONNECT(start); CONNECT(complete); #undef CONNECT }
void Init() { CONNECT(CCube,"triangle",onTriangle); CONNECT(CCube,"sfml",onsfmlEvent); }
void eParentalSetup::init_eParentalSetup() { loadSettings(); parentallock=new eCheckbox(this, parentalpin_enabled, 1); parentallock->setText(_("Parental lock")); parentallock->move(ePoint(10, yPos())); parentallock->resize(eSize(200, widgetHeight())); parentallock->setHelpText(_("enable/disable parental lock")); CONNECT(parentallock->checked, eParentalSetup::plockChecked ); changeParentalPin = new eButton(this); changeParentalPin->setText(_("change PIN")); changeParentalPin->move(ePoint(230, yPos())); changeParentalPin->resize(eSize(160, widgetHeight())); changeParentalPin->setHelpText(_("change Parental PIN (ok)")); changeParentalPin->loadDeco(); CONNECT(changeParentalPin->selected_id, eParentalSetup::changePin ); if ( !parentalpin_enabled ) { changeParentalPin->hide(); } nextYPos(35); setuplock=new eCheckbox(this, setuppin_enabled, 1); setuplock->setText(_("Setup lock")); setuplock->move(ePoint(10, yPos())); setuplock->resize(eSize(200, widgetHeight())); setuplock->setHelpText(_("enable/disable setup lock")); CONNECT(setuplock->checked, eParentalSetup::slockChecked ); changeSetupPin = new eButton(this); changeSetupPin->setText(_("change PIN")); changeSetupPin->move( ePoint( 230, yPos())); changeSetupPin->resize( eSize(160, widgetHeight())); changeSetupPin->setHelpText(_("change Setup PIN (ok)")); changeSetupPin->loadDeco(); CONNECT(changeSetupPin->selected_id, eParentalSetup::changePin ); if ( !setuppin_enabled ) { changeSetupPin->hide(); } nextYPos(35); pin_timeout_label = new eLabel (this); pin_timeout_label->setText (_("Pin timeout")); pin_timeout_label->move (ePoint (10, yPos())); pin_timeout_label->resize (eSize (370, widgetHeight())); pin_timeout = new eNumber (this, 1, 0, 999, 4, &pintimeout, 0, pin_timeout_label); pin_timeout->move (ePoint (230, yPos())); pin_timeout->resize (eSize (50, widgetHeight())); pin_timeout->setHelpText (_("Number of minutes the entered pin is valid. After this timeout you need to re-enter the pin when zapping to protected service (0 to disable)")); pin_timeout->loadDeco(); nextYPos(35); maxpin_errors_label = new eLabel (this); maxpin_errors_label->setText (_("Max Pin errors")); maxpin_errors_label->move (ePoint (10, yPos())); maxpin_errors_label->resize (eSize (370, widgetHeight())); maxpin_errors = new eNumber (this, 1, 0, 999, 4, &maxpinerrors, 0, maxpin_errors_label); maxpin_errors->move (ePoint (230, yPos())); maxpin_errors->resize (eSize (50, widgetHeight())); maxpin_errors->setHelpText (_("Maximum number of chances to enter correct pin. When pin is entered wrong for x times the pin validation will be blocked temporarily (0 to disable)")); maxpin_errors->loadDeco(); nextYPos(35); pinerror_block_time_label = new eLabel (this); pinerror_block_time_label->setText (_("Pin block timeout")); pinerror_block_time_label->move (ePoint (10, yPos())); pinerror_block_time_label->resize (eSize (370, widgetHeight())); pinerror_block_time = new eNumber (this, 1, 1, 999, 4, &pinerrorblocktime, 0, pinerror_block_time_label); pinerror_block_time->move (ePoint (230, yPos())); pinerror_block_time->resize (eSize (50, widgetHeight())); pinerror_block_time->setHelpText (_("Number of minutes pincode check is disabled when pin validation has failed maximum times.")); pinerror_block_time->loadDeco(); nextYPos(35); hidelocked=new eCheckbox(this, shidelocked, 1); hidelocked->setText(_("Hide locked services")); hidelocked->move(ePoint(10, yPos())); hidelocked->resize(eSize(380, widgetHeight())); hidelocked->setHelpText(_("don't show locked services in any list")); hidelocked->loadDeco(); CONNECT(hidelocked->checked, eParentalSetup::hidelockChecked ); if ( !parentalpin_enabled ) { hidelocked->hide(); } /* help text for parental setup */ setHelpText(_("\tParental Lock\n\n>>> [MENU] >>> [6] Setup >>> [5] Parental Lock\n. . . . . . . . . .\n\n" \ "Here you can enable and setup Parental Lock. After reboot locked channels will not be available unless unlocked with your PIN code\n" \ ". . . . . . . . . .\n\nUsage:\n\n[UP]/[DOWN]\tSelect Inputfield or Button\n\nParental lock\tToggle Channel access on/off\n\n" \ "Setup lock\tToggle setup access on/off\n\nChange PIN\tEnter a new PIN code\n\n[GREEN]\tSave Settings and Close Window\n\n" \ "[EXIT]\tClose window without saving changes")); buildWindow(); CONNECT(bOK->selected, eParentalSetup::okPressed); }
void eNFSSetup::mountPressed() { if(sdir->getText().length()==0 || ldir->getText().length()==0) { errorMessage(_("invalid or missing dir or local dir")); return; } else { if(ismounted(ldir->getText())) { eString error=_("NFS/CIFS mount error already mounted"); int tmp = (int)combo_fstype->getCurrent()->getKey(); error.strReplace("NFS/CIFS", tmp == 2 ? "SMBFS" : tmp == 1 ? "CIFS" : "NFS" ); errorMessage(error); return; } eString opt; int fstype = (int)combo_fstype->getCurrent()->getKey(); switch(fstype) { case 0: // NFS { opt.sprintf("/bin/mount -t nfs %d.%d.%d.%d:/%s", ip->getNumber(0),ip->getNumber(1), ip->getNumber(2),ip->getNumber(3), sdir->getText().c_str()); if( combo_options->getCurrent()->getKey() && extraoptions->getText() ) opt+=eString().sprintf(" -o %s,%s", combo_options->getCurrent()->getText().c_str(), extraoptions->getText().c_str()); else if( combo_options->getCurrent()->getKey() ) opt+=eString().sprintf(" -o %s", combo_options->getCurrent()->getText().c_str()); else if( extraoptions->getText() ) opt+=eString().sprintf(" -o %s", extraoptions->getText().c_str()); opt+=' '; opt+=ldir->getText().c_str(); break; } case 1: // CIFS { opt.sprintf("/bin/mount -t cifs //bla -o user=%s,pass=%s,unc=//%d.%d.%d.%d/%s", user->getText().c_str(), pass->getText().c_str(), ip->getNumber(0),ip->getNumber(1), ip->getNumber(2),ip->getNumber(3), sdir->getText().c_str()); if( combo_options->getCurrent()->getKey() && extraoptions->getText() ) opt+=eString().sprintf(",%s,%s", combo_options->getCurrent()->getText().c_str(), extraoptions->getText().c_str()); else if( combo_options->getCurrent()->getKey() ) opt+=eString().sprintf(",%s", combo_options->getCurrent()->getText().c_str()); else if( extraoptions->getText() ) opt+=eString().sprintf(",%s", extraoptions->getText().c_str()); opt+=' '; opt+=ldir->getText().c_str(); break; } case 2: // SMBFS { opt.sprintf("/bin/smbmount %s %s -U %s -I %d.%d.%d.%d -c \"mount %s\"", sdir->getText().c_str(), pass->getText().c_str(), user->getText().c_str(), ip->getNumber(0),ip->getNumber(1), ip->getNumber(2),ip->getNumber(3), ldir->getText().c_str()); break; } default: errorMessage("not supported network file system"); return; } if (!mountContainer) { // eDebug("%s", opt.c_str() ); mountContainer = new eConsoleAppContainer(opt.c_str()); CONNECT(mountContainer->appClosed, eNFSSetup::appClosed); } if ( fstype == 2 ) timeout.start(1500,true); else timeout.start(3000,true); } }
/** * First Panel - Meta Info * All the usual MetaData are displayed and can be changed. **/ MetaPanel::MetaPanel( QWidget *parent, intf_thread_t *_p_intf ) : QWidget( parent ), p_intf( _p_intf ) { QGridLayout *metaLayout = new QGridLayout( this ); metaLayout->setVerticalSpacing( 0 ); QFont smallFont = QApplication::font(); smallFont.setPointSize( smallFont.pointSize() - 1 ); smallFont.setBold( true ); int line = 0; /* Counter for GridLayout */ p_input = NULL; QLabel *label; #define ADD_META( string, widget, col, colspan ) { \ label = new QLabel( qtr( string ) ); label->setFont( smallFont ); \ label->setContentsMargins( 3, 2, 0, 0 ); \ metaLayout->addWidget( label, line++, col, 1, colspan ); \ widget = new QLineEdit; \ metaLayout->addWidget( widget, line, col, 1, colspan ); \ CONNECT( widget, textEdited( QString ), this, enterEditMode() ); \ } /* Title, artist and album*/ ADD_META( VLC_META_TITLE, title_text, 0, 10 ); line++; ADD_META( VLC_META_ARTIST, artist_text, 0, 10 ); line++; ADD_META( VLC_META_ALBUM, collection_text, 0, 7 ); /* Date */ label = new QLabel( qtr( VLC_META_DATE ) ); label->setFont( smallFont ); label->setContentsMargins( 3, 2, 0, 0 ); metaLayout->addWidget( label, line - 1, 7, 1, 2 ); /* Date (Should be in years) */ date_text = new QLineEdit; date_text->setAlignment( Qt::AlignRight ); date_text->setInputMask("0000"); date_text->setMaximumWidth( 128 ); metaLayout->addWidget( date_text, line, 7, 1, -1 ); line++; /* Genre Name */ /* TODO List id3genres.h is not includable yet ? */ ADD_META( VLC_META_GENRE, genre_text, 0, 7 ); /* Number - on the same line */ label = new QLabel( qtr( VLC_META_TRACK_NUMBER ) ); label->setFont( smallFont ); label->setContentsMargins( 3, 2, 0, 0 ); metaLayout->addWidget( label, line - 1, 7, 1, 3 ); tracknumber_text = new QLineEdit; tracknumber_text->setAlignment( Qt::AlignRight ); tracknumber_text->setInputMask("0000/0000"); tracknumber_text->setMaximumWidth( 128 ); metaLayout->addWidget( tracknumber_text, line, 7, 1, -1 ); line++; /* Rating - on the same line */ /* metaLayout->addWidget( new QLabel( qtr( VLC_META_RATING ) ), line, 4, 1, 2 ); rating_text = new QSpinBox; setSpinBounds( rating_text ); metaLayout->addWidget( rating_text, line, 6, 1, 1 ); */ /* Now Playing - Useful for live feeds (HTTP, DVB, ETC...) */ ADD_META( VLC_META_NOW_PLAYING, nowplaying_text, 0, 7 ); nowplaying_text->setReadOnly( true ); line--; /* Language on the same line */ ADD_META( VLC_META_LANGUAGE, language_text, 7, -1 ); line++; ADD_META( VLC_META_PUBLISHER, publisher_text, 0, 7 ); line++; lblURL = new QLabel; lblURL->setOpenExternalLinks( true ); lblURL->setTextFormat( Qt::RichText ); metaLayout->addWidget( lblURL, line -1, 7, 1, -1 ); ADD_META( VLC_META_COPYRIGHT, copyright_text, 0, 7 ); line++; /* ART_URL */ art_cover = new CoverArtLabel( this, p_intf ); metaLayout->addWidget( art_cover, line, 7, 6, 3, Qt::AlignLeft ); ADD_META( VLC_META_ENCODED_BY, encodedby_text, 0, 7 ); line++; label = new QLabel( qtr( N_("Comments") ) ); label->setFont( smallFont ); label->setContentsMargins( 3, 2, 0, 0 ); metaLayout->addWidget( label, line++, 0, 1, 7 ); description_text = new QTextEdit; description_text->setAcceptRichText( false ); metaLayout->addWidget( description_text, line, 0, 1, 7 ); // CONNECT( description_text, textChanged(), this, enterEditMode() ); //FIXME line++; /* VLC_META_SETTING: Useless */ /* ADD_META( TRACKID ) Useless ? */ /* ADD_URI - Do not show it, done outside */ metaLayout->setColumnStretch( 1, 20 ); metaLayout->setColumnMinimumWidth ( 1, 80 ); metaLayout->setRowStretch( line, 10 ); #undef ADD_META CONNECT( tracknumber_text, textEdited( QString ), this, enterEditMode() ); CONNECT( date_text, textEdited( QString ), this, enterEditMode() ); // CONNECT( THEMIM->getIM(), artChanged( QString ), this, enterEditMode() ); /* CONNECT( rating_text, valueChanged( QString ), this, enterEditMode( QString ) );*/ /* We are not yet in Edit Mode */ b_inEditMode = false; }
void eZapNetworkSetup::init_eZapNetworkSetup() { __u32 sip=ntohl(0x0a000061), snetmask=ntohl(0xFF000000), sdns=ntohl(0x7f000001), sgateway=ntohl(0x7f000001); int de[4]; int sdosetup=0; int connectionType=0; int webifport=80; int useDHCP=0; #ifdef USE_IFUPDOWN bool automatic_start; std::string Ip, Netmask, Broadcast, Gateway; useDHCP=!getInetAttributes("eth0", automatic_start, Ip, Netmask, Broadcast, Gateway); sdosetup=automatic_start; #else eConfig::getInstance()->getKey("/elitedvb/network/usedhcp", useDHCP); eConfig::getInstance()->getKey("/elitedvb/network/dosetup", sdosetup); #endif if (useDHCP) { getIP("eth0", sip, snetmask); getDefaultGateway(sgateway); getNameserver(sdns); } else { #ifdef USE_IFUPDOWN int tmp[4]; if ( sscanf(Ip.c_str(), "%d.%d.%d.%d", tmp, tmp+1, tmp+2, tmp+3) == 4 ) sip = tmp[0]<<24 | tmp[1] << 16 | tmp[2] << 8 | tmp[3]; else eDebug("couldn't parse ip(%s)", Ip.length()?Ip.c_str():""); if ( sscanf(Netmask.c_str(), "%d.%d.%d.%d", tmp, tmp+1, tmp+2, tmp+3) == 4 ) snetmask = tmp[0]<<24 | tmp[1] << 16 | tmp[2] << 8 | tmp[3]; else eDebug("couldn't parse netmask(%s)", Netmask.length()?Netmask.c_str():""); if ( sscanf(Gateway.c_str(), "%d.%d.%d.%d", tmp, tmp+1, tmp+2, tmp+3) == 4 ) sgateway = tmp[0]<<24 | tmp[1] << 16 | tmp[2] << 8 | tmp[3]; else eDebug("couldn't parse gateway(%s)", Gateway.length()?Gateway.c_str():""); getNameserver(sdns); // read always from /etc/resolv.conf #else eConfig::getInstance()->getKey("/elitedvb/network/ip", sip); eConfig::getInstance()->getKey("/elitedvb/network/netmask", snetmask); eConfig::getInstance()->getKey("/elitedvb/network/gateway", sgateway); eConfig::getInstance()->getKey("/elitedvb/network/dns", sdns); #endif } eConfig::getInstance()->getKey("/elitedvb/network/connectionType", connectionType); eConfig::getInstance()->getKey("/elitedvb/network/webifport", webifport); eNumber::unpack(sip, de); ip=CreateSkinnedNumberWithLabel("ip",0, 4, 0, 255, 3, de, 0, "lip", !useDHCP); ip->setFlags(eNumber::flagDrawPoints); CONNECT(ip->selected, eZapNetworkSetup::fieldSelected); dhcp = CreateSkinnedCheckbox("dhcp", useDHCP); CONNECT(dhcp->checked, eZapNetworkSetup::dhcpStateChanged); eNumber::unpack(snetmask, de); netmask=CreateSkinnedNumberWithLabel("netmask",0, 4, 0, 255, 3, de, 0, "lnetmask", !useDHCP); netmask->setFlags(eNumber::flagDrawPoints); CONNECT(netmask->selected, eZapNetworkSetup::fieldSelected); eListBoxEntryText *sel=0; combo_type=CreateSkinnedComboBoxWithLabel("combo_type", 3, "lcombo_type"); #ifdef ENABLE_PPPOE if ( !connectionType ) #endif { sel = new eListBoxEntryText( *combo_type, _("LAN"), (void*)0, 0, _("communicate to Local Area Network")); #ifdef ENABLE_PPPOE new eListBoxEntryText( *combo_type, _("WAN(PPPoE)"), (void*)1, 0, _("communicate to the Internet via DSL")); #endif } #ifdef ENABLE_PPPOE else { new eListBoxEntryText( *combo_type, _("LAN"), (void*)0, 0, _("communicate to Local Area Network")); sel = new eListBoxEntryText( *combo_type, _("WAN(PPPoE)"), (void*)1, 0, _("communicate to the Internet via DSL")); } CONNECT(combo_type->selchanged, eZapNetworkSetup::typeChanged); tdsl = new eButton(this); tdsl->move(ePoint(340,90)); tdsl->resize(eSize(100, fd+10)); tdsl->setText("T-DSL"); tdsl->loadDeco(); tdsl->hide(); tdsl->setHelpText(_("T-Online User press ok here")); CONNECT( tdsl->selected, eZapNetworkSetup::tdslPressed ); #endif eNumber::unpack(sdns, de); dns=CreateSkinnedNumberWithLabel("dns",0, 4, 0, 255, 3, de, 0, "lNameserver", !useDHCP); dns->setFlags(eNumber::flagDrawPoints); CONNECT(dns->selected, eZapNetworkSetup::fieldSelected); #ifdef ENABLE_PPPOE lLogin=new eLabel(this); lLogin->setText(_("Login:"******"/elitedvb/network/login", strLogin); login=new eTextInputField(this,lLogin); login->move(ePoint(160, 130)); login->resize(eSize(280, fd+10)); login->setMaxChars(100); login->loadDeco(); login->setHelpText(_("press ok to edit your provider login name")); if ( strLogin ) login->setText(strLogin); login->hide(); CONNECT(login->selected, eZapNetworkSetup::loginSelected ); #endif eNumber::unpack(sgateway, de); gateway=CreateSkinnedNumberWithLabel("gateway",0, 4, 0, 255, 3, de, 0, "lgateway", !useDHCP); gateway->setFlags(eNumber::flagDrawPoints); CONNECT(gateway->selected, eZapNetworkSetup::fieldSelected); #ifdef ENABLE_PPPOE lPassword=new eLabel(this); lPassword->setText(_("Password:"******"press ok to edit your provider password")); password->hide(); CONNECT(password->selected, eZapNetworkSetup::passwordSelected); #endif dosetup=CreateSkinnedCheckbox("dosetup", sdosetup); port=CreateSkinnedNumberWithLabel("port",webifport, 1, 0, 65536, 5, 0, 0, "lport"); port->setFlags(eNumber::flagDrawPoints); CONNECT(port->selected, eZapNetworkSetup::fieldSelected); #ifdef ENABLE_PPPOE int flags = getRejectFlags(); rejectWWW=new eCheckbox(this, flags&1, 1); rejectWWW->setText("WWW"); rejectWWW->move(ePoint(20,255)); rejectWWW->resize(eSize(90, fd+4)); rejectWWW->setHelpText(eString().sprintf(_("reject incoming connections on port %d"), webifport)); rejectWWW->hide(); rejectTelnet=new eCheckbox(this, flags&2, 1); rejectTelnet->setText("Telnet"); rejectTelnet->move(ePoint(130,255)); rejectTelnet->resize(eSize(90, fd+4)); rejectTelnet->setHelpText(eString().sprintf(_("reject incoming connections on port %d"), 23)); rejectTelnet->hide(); rejectSamba=new eCheckbox(this, flags&4, 1); rejectSamba->setText("Samba"); rejectSamba->move(ePoint(240,255)); rejectSamba->resize(eSize(100, fd+4)); rejectSamba->setHelpText(_("reject incoming connections on ports 137,138,139")); rejectSamba->hide(); rejectFTP=new eCheckbox(this, flags&8, 1); rejectFTP->setText("FTP"); rejectFTP->move(ePoint(360,255)); rejectFTP->resize(eSize(70, fd+4)); rejectFTP->setHelpText(eString().sprintf(_("reject incoming connections on port %d"), 21)); rejectFTP->hide(); #endif CONNECT(CreateSkinnedButton("ok")->selected, eZapNetworkSetup::okPressed); #ifndef DISABLE_NFS nfs = CreateSkinnedButton("nfs"); CONNECT(nfs->selected, eZapNetworkSetup::nfsPressed ); #else CreateSkinnedButton("nfs")->hide(); #endif BuildSkin("eZapNetworkSetup"); setHelpID(82); combo_type->setCurrent(sel,true); #ifdef ENABLE_PPPOE if ( readSecretString( secrets ) && secrets ) { unsigned int pos = secrets.find("*"); if ( pos != eString::npos ) { login->setText( secrets.left(pos) ); password->setText("******"); } } #endif }
SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent, bool _static ) : QSlider( q, _parent ), b_classic( _static ) { isSliding = false; f_buffering = 1.0; mHandleOpacity = 1.0; chapters = NULL; mHandleLength = -1; b_seekable = true; alternativeStyle = NULL; // prepare some static colors QPalette p = palette(); QColor background = p.color( QPalette::Active, QPalette::Window ); tickpointForeground = p.color( QPalette::Active, QPalette::WindowText ); tickpointForeground.setHsv( tickpointForeground.hue(), ( background.saturation() + tickpointForeground.saturation() ) / 2, ( background.value() + tickpointForeground.value() ) / 2 ); // set the background color and gradient QColor backgroundBase( p.window().color() ); backgroundGradient.setColorAt( 0.0, backgroundBase.darker( 140 ) ); backgroundGradient.setColorAt( 1.0, backgroundBase ); // set the foreground color and gradient QColor foregroundBase( 50, 156, 255 ); foregroundGradient.setColorAt( 0.0, foregroundBase ); foregroundGradient.setColorAt( 1.0, foregroundBase.darker( 140 ) ); // prepare the handle's gradient handleGradient.setColorAt( 0.0, p.window().color().lighter( 120 ) ); handleGradient.setColorAt( 0.9, p.window().color().darker( 120 ) ); // prepare the handle's shadow gradient QColor shadowBase = p.shadow().color(); if( shadowBase.lightness() > 100 ) shadowBase = QColor( 60, 60, 60 ); // Palette's shadow is too bright shadowDark = shadowBase.darker( 150 ); shadowLight = shadowBase.lighter( 180 ); shadowLight.setAlpha( 50 ); /* Timer used to fire intermediate updatePos() when sliding */ seekLimitTimer = new QTimer( this ); seekLimitTimer->setSingleShot( true ); /* Tooltip bubble */ mTimeTooltip = new TimeTooltip( this ); mTimeTooltip->setMouseTracking( true ); /* Properties */ setRange( MINIMUM, MAXIMUM ); setSingleStep( 2 ); setPageStep( 10 ); setMouseTracking( true ); setTracking( true ); setFocusPolicy( Qt::NoFocus ); /* Use the new/classic style */ if( !b_classic ) { alternativeStyle = new SeekStyle; setStyle( alternativeStyle ); } /* Init to 0 */ setPosition( -1.0, 0, 0 ); secstotimestr( psz_length, 0 ); animHandle = new QPropertyAnimation( this, "handleOpacity", this ); animHandle->setDuration( FADEDURATION ); animHandle->setStartValue( 0.0 ); animHandle->setEndValue( 1.0 ); hideHandleTimer = new QTimer( this ); hideHandleTimer->setSingleShot( true ); hideHandleTimer->setInterval( FADEOUTDELAY ); CONNECT( this, sliderMoved( int ), this, startSeekTimer() ); CONNECT( seekLimitTimer, timeout(), this, updatePos() ); CONNECT( hideHandleTimer, timeout(), this, hideHandle() ); mTimeTooltip->installEventFilter( this ); }
eStreamThread::eStreamThread(): m_messagepump(eApp, 0) { CONNECT(m_messagepump.recv_msg, eStreamThread::recvEvent); m_running = false; }