Esempio n. 1
0
void QIDialogButtonBox::addExtraLayout (QLayout* aLayout)
{
    QBoxLayout *layout = boxLayout();
    int index = findEmptySpace (layout);
    layout->insertLayout (index + 1, aLayout);
    layout->insertStretch(index + 2);
}
behaviour_settings::behaviour_settings(QWidget *parent) :
    QWidget(parent)
{

  QLabel *lbl = new QLabel(tr("<b>Under the Hood</b>"));
  trCon = new QCheckBox(tr("Tray Icon           *May Require Restart"));
  notifi = new QCheckBox(tr("Allow Notifications"));
  runBhd = new QCheckBox(tr("Keep Running in the Background"));
  quitPlistEnd = new QCheckBox(tr("Quit at the end of playlist"));
  QPushButton * apli = new QPushButton(tr("Apply"));

 QBoxLayout *hlay = new QHBoxLayout;
 hlay->addStretch(1);
 hlay->addWidget(apli);


 QBoxLayout *vlay = new QVBoxLayout;
 vlay->setMargin(0);
 vlay->setSpacing(0);
 vlay->addWidget(lbl);
 vlay->addWidget(trCon);
 vlay->addWidget(runBhd);
 vlay->addWidget(notifi);
 vlay->addWidget(quitPlistEnd);
 vlay->addLayout(hlay);
 vlay->insertStretch(12);

 setLayout(vlay);
 flags = new QMap<QString, QVariant>;

 connect(notifi,SIGNAL(stateChanged(int)),this,SLOT(ntfyType(int)));
 connect(trCon, SIGNAL(stateChanged(int)),this,SLOT(tray(int)));
 connect(runBhd, SIGNAL(stateChanged(int)),this,SLOT(bckgd(int)));
 connect(quitPlistEnd,SIGNAL(stateChanged(int)),this,SLOT(quitPlaylistEnd(int)));
 connect(apli,SIGNAL(clicked()),this,SLOT(writeAll()));

 readSettings();


}
Esempio n. 3
0
pFileDialog::pFileDialog( QWidget* parent, const QString& caption, const QString& directory, const QString& filter, bool textCodecEnabled, bool openReadOnlyEnabled )
	: QFileDialog( parent, caption, directory, filter )
{
	setFileMode( QFileDialog::AnyFile );
	setOption( QFileDialog::DontUseNativeDialog );
	
	// get grid layout
	glDialog = qobject_cast<QGridLayout*>( layout() );
	
	// assert on gridlayout
	Q_ASSERT( glDialog );
	
	// relook the dialog to be more friendly
	QLabel* lLookIn = findChild<QLabel*>( "lookInLabel" );
	QComboBox* cbLookIn = findChild<QComboBox*>( "lookInCombo" );
	QToolButton* tbNewFolder = findChild<QToolButton*>( "newFolderButton" );
	QAbstractItemView* sidebar = findChild<QAbstractItemView*>( "sidebar" );
	QFrame* fFrame = findChild<QFrame*>( "frame" );
	QBoxLayout* hLayout = 0;
	
	// search layout containing tbNewFolder
	foreach ( QLayout* layout, findChildren<QLayout*>() ) {
		if ( layout->indexOf( tbNewFolder ) != -1 ) {
			hLayout = qobject_cast<QBoxLayout*>( layout );
			break;
		}
	}
	
	if ( lLookIn ) {
		lLookIn->setVisible( false );
	}
	
	if ( hLayout ) {
		hLayout->setSpacing( 3 );
		hLayout->insertStretch( hLayout->indexOf( tbNewFolder ) );
	}
	
	if ( cbLookIn && fFrame ) {
		QBoxLayout* vLayout = qobject_cast<QBoxLayout*>( fFrame->layout() );
		
		if ( vLayout ) {
			vLayout->setSpacing( 3 );
			vLayout->insertWidget( 0, cbLookIn );
			
			if ( hLayout ) {
				glDialog->removeItem( hLayout );
				hLayout->setParent( 0 );
				vLayout->insertLayout( 0, hLayout );
			}
		}
	}
	
	if ( sidebar ) {
		QWidget* viewport = sidebar->viewport();
		QPalette pal = viewport->palette();
		pal.setColor( viewport->backgroundRole(), QColor( Qt::transparent ) );
		viewport->setPalette( pal );
		sidebar->setFrameStyle( QFrame::NoFrame | QFrame::Plain );
		sidebar->setIconSize( QSize( 16, 16 ) );
	}
	
	// text codec
	mTextCodecEnabled = true;
	
	lCodec = new QLabel( tr( "Codec:" ), this );
	cbCodec = new QComboBox( this );
	cbCodec->addItems( pCoreUtils::textCodecs() );
	setTextCodec( QTextCodec::codecForLocale()->name() );
	
	glDialog->addWidget( lCodec, 4, 0 );
	glDialog->addWidget( cbCodec, 4, 1 );
	
	// read only
	mOpenReadOnlyEnabled = true;
	
	cbOpenReadOnly = new QCheckBox( tr( "Open in read only." ), this );
	
	glDialog->addWidget( cbOpenReadOnly, 5, 1 );
	
	// configuration
	setTextCodecEnabled( textCodecEnabled );
	setOpenReadOnlyEnabled( openReadOnlyEnabled );
}
Esempio n. 4
0
ShaderEdit::ShaderEdit( QWidget *parent, Parameter *p ) : ParameterWidget( parent, p ), progress( NULL )
{
	box = new QBoxLayout( QBoxLayout::TopToBottom );
	box->setContentsMargins( 0, 0, 0, 0 );
	
	QBoxLayout *allLayout = new QBoxLayout( QBoxLayout::TopToBottom );
	
	QBoxLayout *localLayout = new QBoxLayout( QBoxLayout::LeftToRight );
	localComboLabel = new QLabel( tr("Available effects:") );
	widgets.append( localComboLabel );
	localLayout->addWidget( localComboLabel );
	localShadersCombo = new QComboBox();
	widgets.append( localShadersCombo );
	localLayout->addWidget( localShadersCombo );
	localLayout->addSpacerItem( new QSpacerItem( 10, 1 ) );
	editCheckBox = new QCheckBox( tr("Edit...") );
	widgets.append( editCheckBox );
	localLayout->addWidget( editCheckBox );
	localLayout->setStretch( 0, 1 );
	localLayout->setStretch( 1, 1 );
	localLayout->setStretch( 2, 2 );
	allLayout->addLayout( localLayout );
	
	editor = new QPlainTextEdit();
	//QFont font = QFontDatabase::systemFont( QFontDatabase::FixedFont );
	QFont font( "Sans" );
	//font.setPointSize( 12 );
	editor->setFont( font );
	editor->setStyleSheet( "QPlainTextEdit{ background-color:#FFFEC7; color:black; }" );
	editor->setTabStopWidth( QFontMetrics( font ).averageCharWidth() * 2 );
	highlighter = new Highlighter( editor->document() );
	widgets.append( editor );
	allLayout->addWidget( editor );
	editor->hide();
	
	QBoxLayout *applyLayout = new QBoxLayout( QBoxLayout::LeftToRight );
	applyBtn = new QPushButton( tr("Apply") );
	applyBtn->hide();
	widgets.append( applyBtn );
	helpBtn = new QPushButton( tr("Help") );
	helpBtn->hide();
	widgets.append( helpBtn );
	applyLayout->addWidget( applyBtn );
	applyLayout->insertStretch( 1, 1 );
	applyLayout->addWidget( helpBtn );
	allLayout->addLayout( applyLayout );
	
	localShadersGroup = new QGroupBox();
	localShadersGroup->setLayout( allLayout );
	
	box->addWidget( localShadersGroup );

	editor->setPlainText( p->value.toString() );
	applyBtn->setEnabled( false );

	QStringList list = ShaderCollection::getGlobalInstance()->localShadersNames();
	foreach( const QString & s, list )
		localShadersCombo->addItem( s );

	QString shaderName = Parameter::getShaderName( p->value.toString() );
	for ( int i = 0; i < localShadersCombo->count(); ++i ) {
		if ( localShadersCombo->itemText( i ) == shaderName ) {
			localShadersCombo->setCurrentIndex( i );
			break;
		}
	}	
	
	connect( editor, SIGNAL(textChanged()), this, SLOT(textChanged()) );
	connect( editor, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged()) );
	connect( applyBtn, SIGNAL(clicked()), this, SLOT(applyClicked()) );
	connect( helpBtn, SIGNAL(clicked()), this, SLOT(helpClicked()) );
	connect( editCheckBox, SIGNAL(stateChanged(int)), this, SLOT(showEditor(int)) );
	connect( localShadersCombo, SIGNAL(activated(const QString&)), this, SLOT(localShaderChanged(const QString&)) );
}
Esempio n. 5
0
void QBoxLayoutProto::insertStretch(int index, int stretch)
{
  QBoxLayout *item = qscriptvalue_cast<QBoxLayout*>(thisObject());
  if (item)
    item->insertStretch(index, stretch);
}