예제 #1
0
WidgetBoxCategoryListView::WidgetBoxCategoryListView(QDesignerFormEditorInterface *core, QWidget *parent) :
    QListView(parent),
    m_proxyModel(new QSortFilterProxyModel(this)),
    m_model(new WidgetBoxCategoryModel(core, this))
{
    setFocusPolicy(Qt::NoFocus);
    setFrameShape(QFrame::NoFrame);
    setIconSize(QSize(22, 22));
    setSpacing(1);
    setTextElideMode(Qt::ElideMiddle);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setResizeMode(QListView::Adjust);
    setUniformItemSizes(true);

    setItemDelegate(new WidgetBoxCategoryEntryDelegate(this));

    connect(this, SIGNAL(pressed(QModelIndex)), this, SLOT(slotPressed(QModelIndex)));
    setEditTriggers(QAbstractItemView::AnyKeyPressed);

    m_proxyModel->setSourceModel(m_model);
    m_proxyModel->setFilterRole(FilterRole);
    setModel(m_proxyModel);
    connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SIGNAL(scratchPadChanged()));
}
예제 #2
0
void TKeyboard::setLayout(const QString &layoutID, const QStringList &keys)
{
	clearLayout();

	QStringList layout = layoutID.split(QChar('/'));

	QVBoxLayout *vLayout = new QVBoxLayout;

	int i;
	for(i = 0; i < layout.size(); i++) {
		QHBoxLayout *hLayout = new QHBoxLayout;

		int j;
		for(j = 0; j < layout[i].size(); j++) {
			QPushButton *button = new QPushButton("", _frame);
			hLayout->addWidget(button);
			_buttons.append(button);

			connect(button, SIGNAL(pressed()), this, SLOT(slotPressed()));
			connect(button, SIGNAL(clicked(bool)), this, SLOT(slotClicked(bool)));
		}

		vLayout->insertLayout(-1, hLayout);
	}

	setKeys(keys);

	_frame->setLayout(vLayout);
}
예제 #3
0
SkinButton::SkinButton(QPixmap *pixmap, QPixmap *active, 
	QWidget *parent, const char *name, WFlags f)
	: QButton(parent, name, f), pixRegular(pixmap), pixActive(active)
{
	setPixmap(*pixmap);
	QObject::connect(this, SIGNAL(pressed()), SLOT(slotPressed()));
	QObject::connect(this, SIGNAL(released()), SLOT(slotReleased()));
}
예제 #4
0
TDMDelayedPushButton::TDMDelayedPushButton( const KGuiItem &item,
                                            TQWidget *parent, 
                                            const char *name )
	: inherited( item, parent, name )
	, pop( 0 )
{
	connect( this, TQT_SIGNAL(pressed()), TQT_SLOT(slotPressed()) );
	connect( this, TQT_SIGNAL(released()), TQT_SLOT(slotReleased()) );
	connect( &popt, TQT_SIGNAL(timeout()), TQT_SLOT(slotTimeout()) );
}
예제 #5
0
InstrumentAliasButton::InstrumentAliasButton(QWidget *parent,
                               Instrument *instrument) :
        QPushButton(parent),
        m_instrument(instrument)
{
    connect(this, SIGNAL(clicked()), this, SLOT(slotPressed()));
    if (instrument) {
        // Make instrument tell us if it gets destroyed.
        connect(instrument, SIGNAL(destroyed()),
                this, SLOT(slotInstrumentGone()));
    }
}
예제 #6
0
KFinderButton::KFinderButton( const char *_text, KFinder *_finder ) : QPushButton( _text, _finder )
{
    connect( this, SIGNAL( pressed() ), this, SLOT( slotPressed() ) );
    setToggleButton( TRUE );
}
예제 #7
0
CollectionSetup::CollectionSetup( QWidget *parent )
        : QWidget( parent )
        , m_rescanDirAction( new QAction( this ) )
{
    m_ui.setupUi(this);

    setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );

    setObjectName( "CollectionSetup" );
    s_instance = this;

    if( KGlobalSettings::graphicEffectsLevel() != KGlobalSettings::NoEffects )
        m_ui.view->setAnimated( true );
    connect( m_ui.view, SIGNAL(clicked(QModelIndex)),
             this, SIGNAL(changed()) );

    connect( m_ui.view, SIGNAL(pressed(QModelIndex)),
             this, SLOT(slotPressed(QModelIndex)) );
    connect( m_rescanDirAction, SIGNAL(triggered()),
             this, SLOT(slotRescanDirTriggered()) );

    KPushButton *rescan = new KPushButton( KIcon( "collection-rescan-amarok" ), i18n( "Full rescan" ), m_ui.buttonContainer );
    rescan->setToolTip( i18n( "Rescan your entire collection. This will <i>not</i> delete any statistics." ) );
    connect( rescan, SIGNAL(clicked()), CollectionManager::instance(), SLOT(startFullScan()) );

    KPushButton *import = new KPushButton( KIcon( "tools-wizard" ), i18n( "Import" ), m_ui.buttonContainer );
    import->setToolTip( i18n( "Import collection and/or statistics from older Amarok versions, the batch scanner or media players." ) );
    connect( import, SIGNAL(clicked()), this, SLOT(importCollection()) );

    QHBoxLayout *buttonLayout = new QHBoxLayout();
    buttonLayout->addWidget( rescan );
    buttonLayout->addWidget( import );
    m_ui.buttonContainer->setLayout( buttonLayout );

    m_recursive = new QCheckBox( i18n("&Scan folders recursively (requires full rescan if newly checked)"), m_ui.checkboxContainer );
    m_monitor   = new QCheckBox( i18n("&Watch folders for changes"), m_ui.checkboxContainer );
    connect( m_recursive, SIGNAL(toggled(bool)), this, SIGNAL(changed()) );
    connect( m_monitor  , SIGNAL(toggled(bool)), this, SIGNAL(changed()) );

    QVBoxLayout *checkboxLayout = new QVBoxLayout();
    checkboxLayout->addWidget( m_recursive );
    checkboxLayout->addWidget( m_monitor );
    m_ui.checkboxContainer->setLayout( checkboxLayout );

    m_recursive->setToolTip( i18n( "If selected, Amarok will read all subfolders." ) );
    m_monitor->setToolTip( i18n( "If selected, the collection folders will be watched "
            "for changes.\nThe watcher will not notice changes behind symbolic links." ) );

    m_recursive->setChecked( AmarokConfig::scanRecursively() );
    m_monitor->setChecked( AmarokConfig::monitorChanges() );

    // set the model _after_ constructing the checkboxes
    m_model = new CollectionFolder::Model( this );
    m_ui.view->setModel( m_model );
    #ifndef Q_OS_WIN
    m_ui.view->setRootIndex( m_model->setRootPath( QDir::rootPath() ) );
    #else
    m_ui.view->setRootIndex( m_model->setRootPath( m_model->myComputer().toString() ) );
    #endif

    Collections::Collection *primaryCollection = CollectionManager::instance()->primaryCollection();
    QStringList dirs = primaryCollection ? primaryCollection->property( "collectionFolders" ).toStringList() : QStringList();
    m_model->setDirectories( dirs );

    // make sure that the tree is expanded to show all selected items
    foreach( const QString &dir, dirs )
    {
        QModelIndex index = m_model->index( dir );
        m_ui.view->scrollTo( index, QAbstractItemView::EnsureVisible );
    }
예제 #8
0
SkinButton::SkinButton(QWidget *parent, const char *name, WFlags f)
	: QButton(parent, name, f), pixRegular(NULL), pixActive(NULL)
{
	QObject::connect(this, SIGNAL(pressed()), SLOT(slotPressed()));
	QObject::connect(this, SIGNAL(released()), SLOT(slotReleased()));
}