Exemple #1
0
ColumnList::ColumnList( QWidget *parent, const char *name )
    : QHBox( parent, name ), m_changed( true )
{
    setSpacing( 5 );

    QVBox *buttonbox = new QVBox( this );

    m_up = new KPushButton( KGuiItem( QString::null, "up" ), buttonbox );
    QToolTip::add( m_up, i18n( "Move column up" ) );
    connect( m_up, SIGNAL( clicked() ), this, SLOT( moveUp() ) );

    m_down = new KPushButton( KGuiItem( QString::null, "down" ), buttonbox );
    QToolTip::add( m_down, i18n( "Move column down" ) );
    connect( m_down, SIGNAL( clicked() ), this, SLOT( moveDown() ) );

    m_list = new KListView( this );
    m_list->addColumn("");
    m_list->header()->hide();
    m_list->setSelectionMode( QListView::Single );
    m_list->setResizeMode( QListView::LastColumn );
    m_list->setSorting( -1 );
    m_list->setAcceptDrops( true );
    m_list->setDragEnabled( true );
    m_list->setDropVisualizer( true );
    m_list->setDropVisualizerWidth( 3 );
    connect( m_list, SIGNAL( moved() ), this, SLOT( updateUI() ) );
    connect( m_list, SIGNAL( moved() ), this, SLOT( setChanged() ) );
    connect( m_list, SIGNAL( currentChanged( QListViewItem* ) ), this, SLOT( updateUI() ) );

    QHeader* const h = Playlist::instance()->header();
    for( int i = h->count() - 1; i >= 0; --i )
    {
        const int s = h->mapToSection( i );
        if( ( s != MetaBundle::Rating || PanaConfig::useRatings() ) &&
            ( s != MetaBundle::Mood   || PanaConfig::showMoodbar() ) &&
            ( s != MetaBundle::Score  || PanaConfig::useScores() ) )
        {
            ( new MyCheckListItem( s, m_list, MetaBundle::prettyColumnName( s ), QCheckListItem::CheckBox, this ) )
                ->setOn( h->sectionSize( s ) );
        }
    }

    m_list->setCurrentItem( m_list->firstChild() );
    updateUI();
    resetChanged();
}
Exemple #2
0
  bool
  State::progressCtsEvent(const Happening* h)
  {
    DerivedGoal::resetLists(this);
    resetChanged();

    if(TestingPNERobustness) JudderPNEs = true;
    bool canHappen = h->canHappen(this);

    if(canHappen || ContinueAnyway)
    {
      time = h->getTime();
      if(TestingPNERobustness) JudderPNEs = false;
      return h->applyTo(this) && canHappen;
    }
    return false;
  }