Example #1
0
PlayList::PlayList(QWidget *parent) : QWidget(parent),
        m_listView(new PlayListView(this)),
        m_buttonBar(new QFrame(this)),
        m_barLayout(new QHBoxLayout(m_buttonBar)),
        m_playButton(0),
        m_moveUpButton(0),
        m_moveDownButton(0),
        m_deleteButton(0),
        m_clearButton(0)
{
    QVBoxLayout *vLayout = new QVBoxLayout;
    vLayout->addWidget(m_listView);
    vLayout->addWidget(m_buttonBar);
    setLayout(vLayout);

    m_openButton = new QPushButton(m_buttonBar);
    m_playButton = new QPushButton(m_buttonBar);
    m_moveUpButton = new QPushButton(m_buttonBar);
    m_moveDownButton = new QPushButton(m_buttonBar);
    m_deleteButton = new QPushButton(m_buttonBar);
    m_clearButton = new QPushButton(m_buttonBar);
    m_barLayout->addWidget(m_openButton);
    m_barLayout->addWidget(m_playButton);
    m_barLayout->addWidget(m_moveUpButton);
    m_barLayout->addWidget(m_moveDownButton);
    m_barLayout->addWidget(m_deleteButton);
    m_barLayout->addWidget(m_clearButton);
    m_barLayout->addStretch();


    m_openButton ->setText(tr("Add..."));
    m_playButton ->setText(tr("Play"));
    m_moveUpButton ->setText(tr("Move Up"));
    m_moveDownButton->setText(tr("Move Down"));
    m_deleteButton ->setText(tr("Remove"));
    m_clearButton ->setText(tr("Clear whole List"));

    connect(m_openButton, SIGNAL(clicked()), SLOT(slotOpenFiles()));
    connect(m_playButton, SIGNAL(clicked()),SLOT(slotPlay()));
    connect(m_deleteButton, SIGNAL(clicked()), SLOT(slotDeleteCurrent()));
    connect(m_clearButton, SIGNAL(clicked()), SLOT(slotClear()));
    connect(m_moveUpButton, SIGNAL(clicked()), SLOT(slotMoveUp()));
    connect(m_moveDownButton, SIGNAL(clicked()), SLOT(slotMoveDown()));
    
    connect(m_listView, SIGNAL(droppedURIs(QDropEvent*, QTreeWidget*, QStringList)),
            SLOT(slotDroppedURIs(QDropEvent*, QTreeWidget*, QStringList)));
    
    connect(m_listView, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
                this, SLOT(slotCurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
    
//     connect(m_listView, SIGNAL(currentChanged(QTreeWidgetItem*)),
//             SLOT(slotCurrentItemChanged(QTreeWidgetItem*)));
//     connect(m_listView, SIGNAL(dropped(QDropEvent*, QTreeWidgetItem*)),
//             SLOT(slotDropped(QDropEvent*, QTreeWidgetItem*)));

    restore();

    enableButtons(0);

}
Settings::CategoryPage::CategoryPage( QWidget* parent )
    : QWidget( parent )
{
    QVBoxLayout* lay1 = new QVBoxLayout(this);
    QHBoxLayout* lay2 = new QHBoxLayout;
    lay1->addLayout( lay2 );

    _categories = new QListWidget( this );
    connect( _categories, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(edit(QListWidgetItem*)) );
    lay2->addWidget( _categories );


    QGridLayout* lay3 = new QGridLayout;
    lay2->addLayout( lay3 );

    int row = 0;

    // Text
    _labelLabel = new QLabel( i18n( "Label:" ), this );
    lay3->addWidget( _labelLabel, row, 0 );

    _text = new KLineEdit( this );
    connect( _text, SIGNAL(textChanged(QString)),
             this, SLOT(slotLabelChanged(QString)) );

    lay3->addWidget( _text, row, 1 );

    row++;

    // Positionable

    _positionableLabel = new QLabel(i18n("Positionable tags:"), this);
    lay3->addWidget( _positionableLabel, row, 0 );

    _positionable = new QCheckBox( i18n("Coordinates can be added to tags in this category"), this);
    lay3->addWidget( _positionable, row, 1 );

    connect( _positionable, SIGNAL(clicked(bool)), this, SLOT(positionableChanged(bool)) );

    row++;

    // Icon
    _iconLabel = new QLabel( i18n("Icon:" ), this );
    lay3->addWidget( _iconLabel, row, 0 );

    _icon = new KIconButton(  this );
    lay3->addWidget( _icon, row, 1 );
    _icon->setIconSize(32);
    _icon->setIcon( QString::fromLatin1( "personsIcon" ) );
    connect( _icon, SIGNAL(iconChanged(QString)), this, SLOT(slotIconChanged(QString)) );

    row++;

    // Thumbnail size
    _thumbnailSizeInCategoryLabel = new QLabel( i18n( "Thumbnail Size: " ), this );
    lay3->addWidget( _thumbnailSizeInCategoryLabel, row, 0 );

    _thumbnailSizeInCategory = new QSpinBox;
    _thumbnailSizeInCategory->setRange( 32, 512 );
    _thumbnailSizeInCategory->setSingleStep( 32 );
    lay3->addWidget( _thumbnailSizeInCategory, row, 1 );
    connect( _thumbnailSizeInCategory, SIGNAL(valueChanged(int)), this, SLOT(thumbnailSizeChanged(int)) );

    row++;

    // Preferred View
    _preferredViewLabel = new QLabel( i18n("Preferred view:"), this );
    lay3->addWidget( _preferredViewLabel, row, 0 );

    _preferredView = new KComboBox( this );
    lay3->addWidget( _preferredView, row, 1 );
    QStringList list;
    list << i18n("List View") << i18n("List View with Custom Thumbnails") << i18n("Icon View") << i18n("Icon View with Custom Thumbnails");
    _preferredView->addItems( list );
    connect( _preferredView, SIGNAL(activated(int)), this, SLOT(slotPreferredViewChanged(int)) );

    QHBoxLayout* lay4 = new QHBoxLayout;
    lay1->addLayout( lay4 );

    KPushButton* newItem = new KPushButton( i18n("New"), this );
    connect( newItem, SIGNAL(clicked()), this, SLOT(slotNewItem()) );

    _delItem = new KPushButton( i18n("Delete"), this );
    connect( _delItem, SIGNAL(clicked()), this, SLOT(slotDeleteCurrent()) );

    lay4->addStretch(1);
    lay4->addWidget( newItem );
    lay4->addWidget( _delItem );

    _current = 0;

    // Untagged images
    _untaggedBox = new UntaggedGroupBox(this);
    lay1->addWidget(_untaggedBox);

}
Example #3
0
    m_importButton = m_view.buttonBox->button(QDialogButtonBox::Ok);
    m_importButton->setText(i18n("import"));
    m_view.treeWidget->setIconSize(QSize(70, 50));
    foreach(const KUrl &url, files) {
        QStringList text;
        text << url.fileName();
        KFileItem file(KFileItem::Unknown, KFileItem::Unknown, url, true);
        text << KIO::convertSize(file.size());
        QTreeWidgetItem *item = new QTreeWidgetItem(m_view.treeWidget, text);
        item->setData(0, Qt::UserRole, url.path());
        item->setToolTip(0, url.path());
        item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
        item->setCheckState(0, Qt::Checked);
    }
    connect(m_view.treeWidget, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotRefreshButtons()));
    connect(m_view.deleteButton, SIGNAL(pressed()), this, SLOT(slotDeleteCurrent()));
    connect(m_view.toggleButton, SIGNAL(pressed()), this, SLOT(slotToggle()));
    QTreeWidgetItem *item = m_view.treeWidget->topLevelItem(0);
    if (item) m_view.treeWidget->setCurrentItem(item);
    connect(m_view.treeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(slotCheckItemIcon()));
    QTimer::singleShot(500, this, SLOT(slotCheckItemIcon()));
    m_view.treeWidget->resizeColumnToContents(0);
    m_view.treeWidget->setEnabled(false);
    adjustSize();
}

ManageCapturesDialog::~ManageCapturesDialog() {}

void ManageCapturesDialog::slotCheckItemIcon()
{
    int ct = 0;