Esempio n. 1
0
int PLModel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QAbstractItemModel::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: currentChanged((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 1: rootChanged(); break;
        case 2: activateItem((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
        case 3: activateItem((*reinterpret_cast< playlist_item_t*(*)>(_a[1]))); break;
        case 4: popupPlay(); break;
        case 5: popupDel(); break;
        case 6: popupInfo(); break;
        case 7: popupStream(); break;
        case 8: popupSave(); break;
        case 9: popupExplore(); break;
        case 10: popupAddNode(); break;
        case 11: popupSort((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 12: processInputItemUpdate((*reinterpret_cast< input_item_t*(*)>(_a[1]))); break;
        case 13: processInputItemUpdate((*reinterpret_cast< input_thread_t*(*)>(_a[1]))); break;
        case 14: processItemRemoval((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 15: processItemAppend((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        default: ;
        }
        _id -= 16;
    }
    return _id;
}
Esempio n. 2
0
void PlaylistWindow::changePlaylistSelection( QUrl itemUrl, QUuid playlistUuid, QUuid itemUuid)
{
    (void)itemUrl;
    if (!activateItem(playlistUuid, itemUuid))
        return;
    auto pl = PlaylistCollection::getSingleton()->playlistOf(playlistUuid);
    if (!itemUuid.isNull() && pl->queueFirst() == itemUuid)
        pl->queueTakeFirst();
}
Esempio n. 3
0
void PlaylistWindow::activateNext()
{
    auto qdp = currentPlaylistWidget();
    auto now = qdp->nowPlayingItem();
    auto pl = PlaylistCollection::getSingleton()->playlistOf(qdp->uuid());
    auto next = pl->itemAfter(now);
    if (!!next)
        activateItem(qdp->uuid(), next->uuid());
}
Esempio n. 4
0
void PlaylistWindow::activatePrevious()
{
    auto qdp = currentPlaylistWidget();
    auto now = qdp->nowPlayingItem();
    auto pl = PlaylistCollection::getSingleton()->playlistOf(qdp->uuid());
    auto prev = pl->itemBefore(now);
    if (!!prev)
        activateItem(qdp->uuid(), prev->uuid());
}
Esempio n. 5
0
//BEGIN VariableSpellCheckEditor
VariableSpellCheckEditor::VariableSpellCheckEditor(VariableSpellCheckItem *item, QWidget *parent)
  : VariableEditor(item, parent)
{
  QGridLayout *l = (QGridLayout*) layout();

  m_dictionaryCombo = new Sonnet::DictionaryComboBox(this);
  m_dictionaryCombo->setCurrentByDictionary(item->value());
  l->addWidget(m_dictionaryCombo, 0, 2, Qt::AlignLeft);

  connect(m_dictionaryCombo, SIGNAL(dictionaryNameChanged(QString)), this, SIGNAL(valueChanged()));
  connect(m_dictionaryCombo, SIGNAL(dictionaryNameChanged(QString)), this, SLOT(activateItem()));
  connect(m_dictionaryCombo, SIGNAL(dictionaryChanged(QString)), this, SLOT(setItemValue(QString)));
}
Esempio n. 6
0
//BEGIN VariableFontEditor
VariableFontEditor::VariableFontEditor(VariableFontItem* item, QWidget* parent)
  : VariableEditor(item, parent)
{
  QGridLayout* l = (QGridLayout *) layout();

  m_comboBox = new KFontComboBox(this);
  m_comboBox->setCurrentFont(item->value());
  l->addWidget(m_comboBox, 0, 2, Qt::AlignLeft);

  connect(m_comboBox, SIGNAL(currentFontChanged(QFont)), this, SIGNAL(valueChanged()));
  connect(m_comboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(activateItem()));
  connect(m_comboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(setItemValue(QFont)));
}
Esempio n. 7
0
//BEGIN VariableStringEditor
VariableStringEditor::VariableStringEditor(VariableStringItem *item, QWidget *parent)
  :VariableEditor(item, parent)
{
  QGridLayout *l = (QGridLayout*) layout();

  m_lineEdit = new QLineEdit(this);
  m_lineEdit->setText(item->value());
  l->addWidget(m_lineEdit, 0, 2, Qt::AlignLeft);

  connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(valueChanged()));
  connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(activateItem()));
  connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(setItemValue(QString)));
}
ItemLibraryTreeView::ItemLibraryTreeView(QWidget *parent) :
    QTreeView(parent)
{
    setDragEnabled(true);
    setDragDropMode(QAbstractItemView::DragOnly);
    setUniformRowHeights(true);
    connect(this, SIGNAL(clicked(QModelIndex)), this, SLOT(activateItem(QModelIndex)));
    setHeaderHidden(true);
    setIndentation(20);
    setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setAttribute(Qt::WA_MacShowFocusRect, false);

    TreeViewStyle *style = new TreeViewStyle;
    setStyle(style);
    style->setParent(this);
    m_delegate = new ResourceItemDelegate(this);
    setItemDelegateForColumn(0, m_delegate);
}
Esempio n. 9
0
BookmarksDialog::BookmarksDialog( intf_thread_t *_p_intf ):QVLCFrame( _p_intf )
{
    setWindowFlags( Qt::Tool );
    setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) );
    setWindowTitle( qtr( "Edit Bookmarks" ) );
    setWindowRole( "vlc-bookmarks" );

    QGridLayout *layout = new QGridLayout( this );

    QPushButton *addButton = new QPushButton( qtr( "Create" ) );
    addButton->setToolTip( qtr( "Create a new bookmark" ) );
    QPushButton *delButton = new QPushButton( qtr( "Delete" ) );
    delButton->setToolTip( qtr( "Delete the selected item" ) );
    QPushButton *clearButton = new QPushButton( qtr( "Clear" ) );
    clearButton->setToolTip( qtr( "Delete all the bookmarks" ) );
#if 0
    QPushButton *extractButton = new QPushButton( qtr( "Extract" ) );
    extractButton->setToolTip( qtr() );
#endif
    QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );

    bookmarksList = new QTreeWidget( this );
    bookmarksList->setRootIsDecorated( false );
    bookmarksList->setAlternatingRowColors( true );
    bookmarksList->setSelectionMode( QAbstractItemView::ExtendedSelection );
    bookmarksList->setSelectionBehavior( QAbstractItemView::SelectRows );
    bookmarksList->setEditTriggers( QAbstractItemView::SelectedClicked );
    bookmarksList->setColumnCount( 3 );
    bookmarksList->resize( sizeHint() );

    QStringList headerLabels;
    headerLabels << qtr( "Description" );
    headerLabels << qtr( "Bytes" );
    headerLabels << qtr( "Time" );
    bookmarksList->setHeaderLabels( headerLabels );


    layout->addWidget( addButton, 0, 0 );
    layout->addWidget( delButton, 1, 0 );
    layout->addWidget( clearButton, 2, 0 );
    layout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ), 4, 0 );
#if 0
    layout->addWidget( extractButton, 5, 0 );
#endif
    layout->addWidget( bookmarksList, 0, 1, 6, 2);
    layout->setColumnStretch( 1, 1 );
    layout->addWidget( closeButton, 7, 2 );

    CONNECT( THEMIM->getIM(), bookmarksChanged(),
             this, update() );

    CONNECT( bookmarksList, activated( QModelIndex ), this,
             activateItem( QModelIndex ) );
    CONNECT( bookmarksList, itemChanged( QTreeWidgetItem*, int ),
             this, edit( QTreeWidgetItem*, int ) );

    BUTTONACT( addButton, add() );
    BUTTONACT( delButton, del() );
    BUTTONACT( clearButton, clear() );
#if 0
    BUTTONACT( extractButton, extract() );
#endif
    BUTTONACT( closeButton, close() );

    readSettings( "Bookmarks", QSize( 435, 280 ) );
    updateGeometry();
}
Esempio n. 10
0
// In-place activation slot.
void qtractorFileListView::itemActivatedSlot ( QTreeWidgetItem *pItem )
{
	activateItem(pItem);
}
Esempio n. 11
0
void VListFolderUE::activate(int p_id)
{
    Q_UNUSED(p_id);
    activateItem(m_listWidget->currentItem());
}
Esempio n. 12
0
void WifiAPItem::mouseReleaseEvent(QMouseEvent *e)
{
    activateItem();
    activate(0);
}
Esempio n. 13
0
RoutingWidget::RoutingWidget( MarbleWidget *marbleWidget, QWidget *parent ) :
    QWidget( parent ), d( new RoutingWidgetPrivate( marbleWidget ) )
{
    d->m_ui.setupUi( this );
    d->m_ui.routeComboBox->setVisible( false );
    d->m_ui.routeComboBox->setModel( d->m_routingManager->alternativeRoutesModel() );

    d->m_routingLayer->synchronizeAlternativeRoutesWith( d->m_ui.routeComboBox );

    d->m_ui.routingProfileComboBox->setModel( d->m_routingManager->profilesModel() );

    connect( d->m_routingManager->profilesModel(), SIGNAL( rowsInserted( QModelIndex, int, int ) ),
             this, SLOT( selectFirstProfile() ) );
    connect( d->m_routingManager->profilesModel(), SIGNAL( modelReset() ),
             this, SLOT( selectFirstProfile() ) );
    connect( d->m_routingLayer, SIGNAL( placemarkSelected( QModelIndex ) ),
             this, SLOT( activatePlacemark( QModelIndex ) ) );
    connect( d->m_routingLayer, SIGNAL( pointSelected( GeoDataCoordinates ) ),
             this, SLOT( retrieveSelectedPoint( GeoDataCoordinates ) ) );
    connect( d->m_routingLayer, SIGNAL( pointSelectionAborted() ),
             this, SLOT( pointSelectionCanceled() ) );
    connect( d->m_routingManager, SIGNAL( stateChanged( RoutingManager::State, RouteRequest* ) ),
             this, SLOT( updateRouteState( RoutingManager::State, RouteRequest* ) ) );
    connect( d->m_routingManager, SIGNAL( routeRetrieved( GeoDataDocument* ) ),
             this, SLOT( indicateRoutingFailure( GeoDataDocument* ) ) );
    connect( d->m_routeRequest, SIGNAL( positionAdded( int ) ),
             this, SLOT( insertInputWidget( int ) ) );
    connect( d->m_routeRequest, SIGNAL( positionRemoved( int ) ),
             this, SLOT( removeInputWidget( int ) ) );
    connect( d->m_routeRequest, SIGNAL( routingProfileChanged() ),
             this, SLOT( updateActiveRoutingProfile() ) );
    connect( &d->m_progressTimer, SIGNAL( timeout() ),
             this, SLOT( updateProgress() ) );
    connect( d->m_ui.routeComboBox, SIGNAL( currentIndexChanged( int ) ),
             this, SLOT( switchRoute( int ) ) );
    connect( d->m_ui.routingProfileComboBox, SIGNAL( currentIndexChanged( int ) ),
             this, SLOT( setRoutingProfile( int ) ) );
    connect( d->m_routingManager->alternativeRoutesModel(), SIGNAL( rowsInserted( QModelIndex, int, int ) ),
             this, SLOT( updateAlternativeRoutes() ) );

    d->m_ui.directionsListView->setModel( d->m_routingModel );

    QItemSelectionModel *selectionModel = d->m_ui.directionsListView->selectionModel();
    d->m_routingLayer->synchronizeWith( selectionModel );
    connect( d->m_ui.directionsListView, SIGNAL( activated ( QModelIndex ) ),
             this, SLOT( activateItem ( QModelIndex ) ) );

    connect( d->m_ui.searchButton, SIGNAL( clicked( ) ),
             this, SLOT( retrieveRoute () ) );
    connect( d->m_ui.showInstructionsButton, SIGNAL( clicked( bool ) ),
             this, SLOT( showDirections() ) );
    connect( d->m_ui.configureButton, SIGNAL( clicked() ),
             this, SLOT( configureProfile() ) );

    for( int i=0; i<d->m_routeRequest->size(); ++i ) {
        insertInputWidget( i );
    }

    for ( int i=0; i<2 && d->m_inputWidgets.size()<2; ++i ) {
        // Start with source and destination if the route is empty yet
        addInputWidget();
    }
    //d->m_ui.descriptionLabel->setVisible( false );
    d->m_ui.resultLabel->setVisible( false );
    setShowDirectionsButtonVisible( false );
    updateActiveRoutingProfile();

    if ( MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen ) {
        d->m_ui.directionsListView->setVisible( false );
#ifdef Q_WS_MAEMO_5
        d->m_ui.directionsListView->setAttribute( Qt::WA_Maemo5StackedWindow );
        d->m_ui.directionsListView->setWindowFlags( Qt::Window );
        d->m_ui.directionsListView->setWindowTitle( tr( "Directions - Marble" ) );
#endif // Q_WS_MAEMO_5
    }
}
UserFunctionListWidget::UserFunctionListWidget(QWidget* parent)
    : QWidget(parent)
    , m_filterTimer(new QTimer(this))
    , m_userFunctions(new QTreeWidget(this))
    , m_noMatchLabel(new QLabel(m_userFunctions))
    , m_searchFilter(new QLineEdit(this))
    , m_searchLabel(new QLabel(this))
{
    m_filterTimer->setInterval(500);
    m_filterTimer->setSingleShot(true);

    m_userFunctions->setAlternatingRowColors(true);
    m_userFunctions->setAutoScroll(true);
    m_userFunctions->setColumnCount(2);
    m_userFunctions->setEditTriggers(QTreeWidget::NoEditTriggers);
    m_userFunctions->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    m_userFunctions->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
    m_userFunctions->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
    m_userFunctions->setRootIsDecorated(false);
    m_userFunctions->setSelectionBehavior(QTreeWidget::SelectRows);
    m_userFunctions->setCursor(QCursor(Qt::PointingHandCursor));

    m_noMatchLabel->setAlignment(Qt::AlignCenter);
    m_noMatchLabel->adjustSize();
    m_noMatchLabel->hide();

    QWidget* searchBox = new QWidget(this);
    QHBoxLayout* searchLayout = new QHBoxLayout;
    searchLayout->addWidget(m_searchLabel);
    searchLayout->addWidget(m_searchFilter);
    searchLayout->setMargin(0);
    searchBox->setLayout(searchLayout);

    QVBoxLayout* layout = new QVBoxLayout;
    layout->setMargin(3);
    layout->addWidget(searchBox);
    layout->addWidget(m_userFunctions);
    setLayout(layout);

    QMenu* contextMenu = new QMenu(m_userFunctions);
    m_insertAction = new QAction("", contextMenu);
    m_editAction = new QAction("", contextMenu);
    m_deleteAction = new QAction("", contextMenu);
    m_deleteAllAction = new QAction("", contextMenu);
    m_userFunctions->setContextMenuPolicy(Qt::ActionsContextMenu);
    m_userFunctions->addAction(m_insertAction);
    m_userFunctions->addAction(m_editAction);
    m_userFunctions->addAction(m_deleteAction);
    m_userFunctions->addAction(m_deleteAllAction);

    QWidget::setTabOrder(m_searchFilter, m_userFunctions);

    retranslateText();

    connect(m_filterTimer, SIGNAL(timeout()), SLOT(fillTable()));
    connect(m_searchFilter, SIGNAL(textChanged(const QString&)), SLOT(triggerFilter()));
    connect(m_userFunctions, SIGNAL(itemActivated(QTreeWidgetItem*, int)), SLOT(activateItem()));
    connect(m_insertAction, SIGNAL(triggered()), SLOT(activateItem()));
    connect(m_editAction, SIGNAL(triggered()), SLOT(editItem()));
    connect(m_deleteAction, SIGNAL(triggered()), SLOT(deleteItem()));
    connect(m_deleteAllAction, SIGNAL(triggered()), SLOT(deleteAllItems()));
}
AnnotationWidget::AnnotationWidget(QWidget *parent, Experiment *exp, int subject, int session) :
    QWidget(parent)
{
    experiment = exp;

    tabWidget = new QTabWidget;
    QVBoxLayout *fulllayout = new QVBoxLayout;
    QWidget *annotationListWidget, *gridWidget;
    annotationListWidget = new QWidget;
    gridWidget = new QWidget;

    QVBoxLayout *vlayout = new QVBoxLayout;
    tree = new QTreeWidget;
    tree->setHeaderHidden(true);
    tree->setColumnCount(3);
    tree->setSelectionBehavior(QAbstractItemView::SelectRows);
    experiment = exp;

    vlayout->addWidget(tree);

    video = tr("Vid");
    ultrasound = tr("Ult");

    free = tr("Free");
    grid = tr("Grid");

    annotationListWidget->setLayout(vlayout);

//    this->setLayout(vlayout);

    connect(tree,SIGNAL(itemSelectionChanged()),this,SLOT(activateItem()));
    connect(tree,SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),this,SLOT(doubleClick(QTreeWidgetItem*,int)));

    active=0;
    drawTree();

    QVBoxLayout *gridlayout = new QVBoxLayout;

    QPushButton *defineGrid = new QPushButton(tr("Define Radial Grid"));

    QHBoxLayout *linesLayout = new QHBoxLayout;
    QSlider *gridLines = new QSlider(Qt::Horizontal);
    gridLines->setRange(0,experiment->ds->nMaxGridLines);
    gridLines->setValue(experiment->ds->nGridLines);
    QSpinBox *spinGridLines = new QSpinBox;
    spinGridLines->setRange(0,experiment->ds->nMaxGridLines);
    spinGridLines->setValue(experiment->fanLines());
    linesLayout->addWidget(gridLines);
    linesLayout->addWidget(spinGridLines);

    connect(spinGridLines,SIGNAL(valueChanged(int)),gridLines,SLOT(setValue(int)));
    connect(gridLines,SIGNAL(valueChanged(int)),spinGridLines,SLOT(setValue(int)));

    gridlayout->addWidget(defineGrid);
    gridlayout->addWidget(new QLabel(tr("Number of intermediate lines")));
    QLabel *lineWarning = new QLabel(tr("<i>Warning: Changing this will wreak havoc on your traces if you attempt to modify them, although the existing data will not be lost. If you botch it and then go back to the old number, all will be well. (So write it down.)</i>"));
    lineWarning->setWordWrap(true);
    gridlayout->addLayout(linesLayout);
    gridlayout->addWidget(lineWarning);

    gridWidget->setLayout(gridlayout);

    // to the outside world
    connect(gridLines,SIGNAL(valueChanged(int)),this,SIGNAL(updateGridLines(int)));
    connect(gridLines,SIGNAL(valueChanged(int)),this,SIGNAL(sendGridToTracers())); // is this actually connected to anything?
    connect(defineGrid,SIGNAL(clicked()),this,SIGNAL(defineGrid()));

    tabWidget->addTab(annotationListWidget,tr("Annotations"));
    tabWidget->addTab(gridWidget,tr("Grid"));

    fulllayout->addWidget(tabWidget);
    this->setLayout(fulllayout);
}
Esempio n. 16
0
bool MLModel::action( QAction *action, const QModelIndexList &indexes )
{
    actionsContainerType a = action->data().value<actionsContainerType>();
    input_item_t *p_input;

    switch ( a.action )
    {

    case ACTION_PLAY:
        if ( ! indexes.empty() && indexes.first().isValid() )
        {
            activateItem( indexes.first() );
            return true;
        }
        break;

    case ACTION_ADDTOPLAYLIST:
        foreach( const QModelIndex &index, indexes )
        {
            if( !index.isValid() ) return false;
            AddItemToPlaylist( itemId( index, MLMEDIA_ID ), false, p_ml, true );
        }
        return true;

    case ACTION_REMOVE:
        doDelete( indexes );
        return true;

    case ACTION_SORT:
        break;

    case ACTION_CLEAR:
        removeAll();
        return true;

    case ACTION_ENQUEUEFILE:
        foreach( const QString &uri, a.uris )
            playlist_Add( THEPL, uri.toAscii().constData(),
                          NULL, PLAYLIST_APPEND | PLAYLIST_PREPARSE,
                          PLAYLIST_END, false, pl_Unlocked );
        return true;

    case ACTION_ENQUEUEDIR:
        if( a.uris.isEmpty() ) return false;
        p_input = input_item_New( a.uris.first().toAscii().constData(), NULL );
        if( unlikely( p_input == NULL ) ) return false;

        /* FIXME: playlist_AddInput() can fail */
        playlist_AddInput( THEPL, p_input,
                           PLAYLIST_APPEND,
                           PLAYLIST_END, true, pl_Unlocked );
        vlc_gc_decref( p_input );
        return true;

    case ACTION_ENQUEUEGENERIC:
        foreach( const QString &uri, a.uris )
        {
            p_input = input_item_New( qtu( uri ), NULL );
            /* Insert options */
            foreach( const QString &option, a.options.split( " :" ) )
            {
                QString temp = colon_unescape( option );
                if( !temp.isEmpty() )
                    input_item_AddOption( p_input, qtu( temp ),
                                          VLC_INPUT_OPTION_TRUSTED );
            }

            /* FIXME: playlist_AddInput() can fail */
            playlist_AddInput( THEPL, p_input,
                    PLAYLIST_APPEND | PLAYLIST_PREPARSE,
                    PLAYLIST_END, false, pl_Unlocked );
            vlc_gc_decref( p_input );
        }
        return true;

    default:
        break;
    }
    return false;
}
Esempio n. 17
0
PackageView::PackageView( QWidget *parent, Qt::WFlags flags )
    : QMainWindow( parent, flags )
{
    setWindowTitle( tr( "Package Manager" ));
    model = new PackageModel( this );

    connect(model, SIGNAL(targetsUpdated(QStringList)),
            this, SLOT(targetsChanged(QStringList)));
    connect(model, SIGNAL(serversUpdated(QStringList)),
            this, SLOT(serversChanged(QStringList)));
    connect(this, SIGNAL(targetChoiceChanged(QString)),
            model, SLOT(userTargetChoice(QString)));
    connect(model, SIGNAL(serverStatus(QString)),
            this, SLOT(postServerStatus(QString)));
    connect(model,  SIGNAL(newlyInstalled(QModelIndex)),
            this, SLOT(selectNewlyInstalled(QModelIndex)));

    //setup view for installed packages
    installedView = new QTreeView( this );
    installedView->setModel( model  );
    installedView->setRootIndex( model->index(InstalledIndex,0,QModelIndex()) );
    installedView->setRootIsDecorated( false );
    installedView->setFrameStyle(QFrame::NoFrame);
    connect( installedView, SIGNAL(activated(QModelIndex)),
            this, SLOT(activateItem(QModelIndex)) );
    connect( model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
            installedView, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
    connect( model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
            installedView, SLOT(rowsRemoved(QModelIndex,int,int)));

    //setup page for installed packages
    QWidget *installedPage = new QWidget;
    QVBoxLayout *vbInstalledPage = new QVBoxLayout( installedPage );
    vbInstalledPage->setMargin( 0 );
    vbInstalledPage->addWidget( installedView );

    //setup view for downloadable packages
    downloadView = new QTreeView( this );
    downloadView->setModel( model );
    downloadView->setRootIndex( model->index(DownloadIndex,0,QModelIndex()) );
    downloadView->setRootIsDecorated( false );
    downloadView->setFrameStyle(QFrame::NoFrame);
    connect( downloadView, SIGNAL(activated(QModelIndex)),
            this, SLOT(activateItem(QModelIndex)) );
    connect( model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
            downloadView, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
    connect( model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
            downloadView, SLOT(rowsRemoved(QModelIndex,int,int)));
    downloadView->setItemDelegate(new DownloadViewDelegate(this));
    installedView->setItemDelegate(new ViewDelegate(this));

    //setup page for downloadable packages
    QWidget *downloadPage = new QWidget(this);
    QVBoxLayout *vbDownloadPage = new QVBoxLayout( downloadPage );
    vbDownloadPage->setSpacing( 2 );
    vbDownloadPage->setMargin( 2 );
    vbDownloadPage->addWidget( downloadView );
    statusLabel = new QLabel( "No Server Chosen", this );
    statusLabel->setWordWrap( true );
    vbDownloadPage->addWidget( statusLabel );

    installedView->hideColumn( 1 );
    installedView->header()->hide();
    downloadView->hideColumn( 1 );
    downloadView->header()->hide();
//TODO: install to media card
     menuTarget = new QMenu( tr( "Install to" ), this );
    new PackageManagerService( this );

    tabWidget = new QTabWidget( this );
    tabWidget->addTab( installedPage, tr( "Installed" ) );
    tabWidget->addTab( downloadPage, tr( "Downloads" ) );
    setCentralWidget( tabWidget );

    KeyFilter *keyFilter = new KeyFilter(tabWidget, this);
    installedView->installEventFilter(keyFilter);
    downloadView->installEventFilter(keyFilter);

    QTimer::singleShot( 0, this, SLOT(init()) );
}
Esempio n. 18
0
BookmarksDialog::BookmarksDialog( intf_thread_t *_p_intf ):QVLCFrame( _p_intf )
{
    b_ignore_updates = false;
    setWindowFlags( Qt::Tool );
    setWindowOpacity( var_InheritFloat( p_intf, "qt-opacity" ) );
    setWindowTitle( qtr( "Edit Bookmarks" ) );
    setWindowRole( "vlc-bookmarks" );

    QHBoxLayout *layout = new QHBoxLayout( this );

    QDialogButtonBox *buttonsBox = new QDialogButtonBox( Qt::Vertical );
    QPushButton *addButton = new QPushButton( qtr( "Create" ) );
    addButton->setToolTip( qtr( "Create a new bookmark" ) );
    buttonsBox->addButton( addButton, QDialogButtonBox::ActionRole );
    delButton = new QPushButton( qtr( "Delete" ) );
    delButton->setToolTip( qtr( "Delete the selected item" ) );
    buttonsBox->addButton( delButton, QDialogButtonBox::ActionRole );
    clearButton = new QPushButton( qtr( "Clear" ) );
    clearButton->setToolTip( qtr( "Delete all the bookmarks" ) );
    buttonsBox->addButton( clearButton, QDialogButtonBox::ResetRole );
#if 0
    QPushButton *extractButton = new QPushButton( qtr( "Extract" ) );
    extractButton->setToolTip( qtr() );
    buttonsBox->addButton( extractButton, QDialogButtonBox::ActionRole );
#endif
    /* ?? Feels strange as Qt guidelines will put reject on top */
    buttonsBox->addButton( new QPushButton( qtr( "&Close" ) ),
                          QDialogButtonBox::RejectRole);

    bookmarksList = new QTreeWidget( this );
    bookmarksList->setRootIsDecorated( false );
    bookmarksList->setAlternatingRowColors( true );
    bookmarksList->setSelectionMode( QAbstractItemView::ExtendedSelection );
    bookmarksList->setSelectionBehavior( QAbstractItemView::SelectRows );
    bookmarksList->setEditTriggers( QAbstractItemView::SelectedClicked );
    bookmarksList->setColumnCount( 3 );
    bookmarksList->resize( sizeHint() );

    QStringList headerLabels;
    headerLabels << qtr( "Description" );
    headerLabels << qtr( "Bytes" );
    headerLabels << qtr( "Time" );
    bookmarksList->setHeaderLabels( headerLabels );

    layout->addWidget( buttonsBox );
    layout->addWidget( bookmarksList );

    CONNECT( THEMIM->getIM(), bookmarksChanged(),
             this, update() );

    CONNECT( bookmarksList, activated( QModelIndex ), this,
             activateItem( QModelIndex ) );
    CONNECT( bookmarksList, itemChanged( QTreeWidgetItem*, int ),
             this, edit( QTreeWidgetItem*, int ) );
    CONNECT( bookmarksList->model(), rowsInserted( const QModelIndex &, int, int ),
             this, updateButtons() );
    CONNECT( bookmarksList->model(), rowsRemoved( const QModelIndex &, int, int ),
             this, updateButtons() );
    CONNECT( bookmarksList->selectionModel(), selectionChanged( const QItemSelection &, const QItemSelection & ),
             this, updateButtons() );
    BUTTONACT( addButton, add() );
    BUTTONACT( delButton, del() );
    BUTTONACT( clearButton, clear() );

#if 0
    BUTTONACT( extractButton, extract() );
#endif
    CONNECT( buttonsBox, rejected(), this, close() );
    updateButtons();

    restoreWidgetPosition( "Bookmarks", QSize( 435, 280 ) );
    updateGeometry();
}