Exemple #1
0
TransactionItem::TransactionItem( QWidget* parent,
                                  ProgressItem *item, bool first )
  : QVBox( parent, "TransactionItem" ), mCancelButton( 0 ), mItem( item )

{
  setSpacing( 2 );
  setMargin( 2 );
  setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) );

  mFrame = new QFrame( this );
  mFrame->setFrameShape( QFrame::HLine );
  mFrame->setFrameShadow( QFrame::Raised );
  mFrame->show();
  setStretchFactor( mFrame, 3 );

  QHBox *h = new QHBox( this );
  h->setSpacing( 5 );

  mItemLabel = new QLabel( item->label(), h );
  // always interpret the label text as RichText, but disable word wrapping
  mItemLabel->setTextFormat( Qt::RichText );
  mItemLabel->setAlignment( Qt::AlignAuto | Qt::AlignVCenter | Qt::SingleLine );
  h->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) );

  mProgress = new QProgressBar( 100, h );
  mProgress->setProgress( item->progress() );

  if ( item->canBeCanceled() ) {
    mCancelButton = new QPushButton( SmallIcon( "cancel" ), QString::null, h );
    QToolTip::add( mCancelButton, i18n("Cancel this operation.") );
    connect ( mCancelButton, SIGNAL( clicked() ),
              this, SLOT( slotItemCanceled() ));
  }

  h = new QHBox( this );
  h->setSpacing( 5 );
  h->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ) );
  mSSLLabel = new SSLLabel( h );
  mSSLLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
  mItemStatus = new QLabel( item->status(), h );
  // always interpret the status text as RichText, but disable word wrapping
  mItemStatus->setTextFormat( Qt::RichText );
  mItemStatus->setAlignment( Qt::AlignAuto | Qt::AlignVCenter | Qt::SingleLine );
  // richtext leads to sizeHint acting as if wrapping was enabled though,
  // so make sure we only ever have the height of one line.
  mItemStatus->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored ) );
  mItemStatus->setFixedHeight( mItemLabel->sizeHint().height() );
  setCrypto( item->usesCrypto() );
  if( first ) hideHLine();
}
Exemple #2
0
KCMCgi::KCMCgi(QWidget *parent, const char *name)
  : KCModule(parent, name)
{
  setButtons(Default|Apply);

  QVBoxLayout *topLayout = new QVBoxLayout(this, 0, KDialog::spacingHint());

  QGroupBox *topBox = new QGroupBox( 1, Horizontal, i18n("Paths to Local CGI Programs"), this );
  topLayout->addWidget( topBox );

  mListBox = new QListBox( topBox );

  QHBox *buttonBox = new QHBox( topBox );
  buttonBox->setSpacing( KDialog::spacingHint() );

  mAddButton = new QPushButton( i18n("Add..."), buttonBox );
  connect( mAddButton, SIGNAL( clicked() ), SLOT( addPath() ) );

  mRemoveButton = new QPushButton( i18n("Remove"), buttonBox );
  connect( mRemoveButton, SIGNAL( clicked() ), SLOT( removePath() ) );
  connect( mListBox, SIGNAL( clicked ( QListBoxItem * )),this, SLOT( slotItemSelected( QListBoxItem *)));

  mConfig = new KConfig("kcmcgirc");

  load();
  updateButton();
  KAboutData *about =
    new KAboutData( I18N_NOOP("kcmcgi"),
                    I18N_NOOP("CGI KIO Slave Control Module"),
                    0, 0, KAboutData::License_GPL,
                    I18N_NOOP("(c) 2002 Cornelius Schumacher") );

  about->addAuthor( "Cornelius Schumacher", 0, "*****@*****.**" );
  setAboutData(about);
}
void PreferencesDialog::addFontOverride( const QString& language ) {
    // Do nothing if the font override already exists.
    int fontOverrideCount = fontOverrideLabels.count();
    for( int i = 0; i < fontOverrideCount; i++ ) {
        if( fontOverrideLabels.at( i )->text() == QObject::tr( language ) )
            return;
    }
    
    QHBox* fontOverrideBox = new QHBox( fontOverridesBox );
    fontOverrideBox->setSpacing( 2 );
    fontOverrideBox->setMargin( 2 );
    QLabel* fontOverrideLabel = new QLabel( QObject::tr( language ), fontOverrideBox );
    QComboBox* fontOverrideFamilyComboBox = new QComboBox( fontOverrideBox );
    initFontFamilyValues( fontOverrideFamilyComboBox, true );
    if( prefs->isFontOverrideFamilyDefined( language ) ) 
        selectFontFamily( fontOverrideFamilyComboBox, prefs->getFontOverrideFamily( language ) );
    QComboBox* fontOverrideSizeComboBox = new QComboBox( fontOverrideBox );
    initFontSizeValues( fontOverrideSizeComboBox, true );
    if( prefs->isFontOverrideSizeDefined( language ) ) 
        selectFontSize( fontOverrideSizeComboBox, prefs->getFontOverrideSize( language ), true );
    fontOverrideBox->setStretchFactor( fontOverrideLabel, 1 );

    fontOverrideBoxes.append( fontOverrideBox );
    fontOverrideLabels.append( fontOverrideLabel );
    fontOverrideFamilyComboBoxes.append( fontOverrideFamilyComboBox );
    fontOverrideSizeComboBoxes.append( fontOverrideSizeComboBox );

    int indexOfFiller = fontOverridesBoxLayout->findWidget( fontOverridesBoxFiller );
    fontOverridesBoxLayout->insertWidget( indexOfFiller, fontOverrideBox ); 
}
Exemple #4
0
TimeSelector::TimeSelector(const QString& selectText, const QString& postfix, const QString& selectWhatsThis,
                           const QString& valueWhatsThis, bool allowHourMinute, QWidget* parent, const char* name)
	: QFrame(parent, name),
	  mLabel(0),
	  mReadOnly(false)
{
	setFrameStyle(QFrame::NoFrame);
	QVBoxLayout* topLayout = new QVBoxLayout(this, 0, KDialog::spacingHint());
	QHBoxLayout* layout = new QHBoxLayout(topLayout, KDialog::spacingHint());
	mSelect = new CheckBox(selectText, this);
	mSelect->setFixedSize(mSelect->sizeHint());
	connect(mSelect, SIGNAL(toggled(bool)), SLOT(selectToggled(bool)));
	QWhatsThis::add(mSelect, selectWhatsThis);
	layout->addWidget(mSelect);

	QHBox* box = new QHBox(this);    // to group widgets for QWhatsThis text
	box->setSpacing(KDialog::spacingHint());
	layout->addWidget(box);
	mPeriod = new TimePeriod(allowHourMinute, box);
	mPeriod->setFixedSize(mPeriod->sizeHint());
	mPeriod->setSelectOnStep(false);
	connect(mPeriod, SIGNAL(valueChanged(int)), SLOT(periodChanged(int)));
	mSelect->setFocusWidget(mPeriod);
	mPeriod->setEnabled(false);

	if (!postfix.isEmpty())
	{
		mLabel = new QLabel(postfix, box);
		QWhatsThis::add(box, valueWhatsThis);
		mLabel->setEnabled(false);
	}
}
void PreferencesDialog::initFontOverrides() {
    QValueList<QString> lang( prefs->getStudyLanguages() );
    int i = 0;
    for( QValueList<QString>::ConstIterator it = lang.begin(); it != lang.end(); it++, i++ ) {
        QString language( *it );
        QHBox* fontOverrideBox = new QHBox( fontOverridesBox );
        fontOverrideBox->setSpacing( 2 );
        fontOverrideBox->setMargin( 2 );
        QLabel* fontOverrideLabel = new QLabel( QObject::tr( language ), fontOverrideBox );
        QComboBox* fontOverrideFamilyComboBox = new QComboBox( fontOverrideBox );
        initFontFamilyValues( fontOverrideFamilyComboBox, true );
        if( prefs->isFontOverrideFamilyDefined( language ) ) 
            selectFontFamily( fontOverrideFamilyComboBox, prefs->getFontOverrideFamily( language ) );
        QComboBox* fontOverrideSizeComboBox = new QComboBox( fontOverrideBox );
        initFontSizeValues( fontOverrideSizeComboBox, true );
        if( prefs->isFontOverrideSizeDefined( language ) ) 
            selectFontSize( fontOverrideSizeComboBox, prefs->getFontOverrideSize( language ), true );
        fontOverrideBox->setStretchFactor( fontOverrideLabel, 1 );

        fontOverrideBoxes.append( fontOverrideBox );
        fontOverrideLabels.append( fontOverrideLabel );
        fontOverrideFamilyComboBoxes.append( fontOverrideFamilyComboBox );
        fontOverrideSizeComboBoxes.append( fontOverrideSizeComboBox );

        fontOverridesBoxLayout->addWidget( fontOverrideBox, 0 );
    }
    fontOverridesBoxFiller = new QWidget( fontOverridesBox );
    fontOverridesBoxLayout->addWidget( fontOverridesBoxFiller, 1 );
}
Exemple #6
0
QueueManager::QueueManager( QWidget *parent, const char *name )
    : KDialogBase( KDialogBase::Swallow, 0, parent, name, false, 0, Ok|Cancel )
{
    s_instance = this;

    // Gives the window a small title bar, and skips a taskbar entry
    KWin::setType( winId(), NET::Utility );
    KWin::setState( winId(), NET::SkipTaskbar );

    kapp->setTopWidget( this );
    setCaption( kapp->makeStdCaption( i18n("Queue Manager") ) );
    setInitialSize( QSize( 400, 260 ) );

    QVBox *mainBox = new QVBox( this );
    setMainWidget( mainBox );

    QHBox *box = new QHBox( mainWidget() );
    box->setSpacing( 5 );
    m_listview = new QueueList( box );

    QVBox *buttonBox = new QVBox( box );
    m_up     = new KPushButton( KGuiItem( QString::null, "up" ), buttonBox );
    m_down   = new KPushButton( KGuiItem( QString::null, "down" ), buttonBox );
    m_remove = new KPushButton( KGuiItem( QString::null, "edit_remove" ), buttonBox );
    m_add    = new KPushButton( KGuiItem( QString::null, "edit_add" ), buttonBox );
    m_clear  = new KPushButton( KGuiItem( QString::null, amaroK::icon( "playlist_clear" ) ), buttonBox );

    QToolTip::add( m_up,     i18n( "Move up" ) );
    QToolTip::add( m_down,   i18n( "Move down" ) );
    QToolTip::add( m_remove, i18n( "Remove" ) );
    QToolTip::add( m_add,    i18n( "Enqueue track" ) );
    QToolTip::add( m_clear,  i18n( "Clear queue" ) );

    m_up->setEnabled( false );
    m_down->setEnabled( false );
    m_remove->setEnabled( false );
    m_add->setEnabled( false );
    m_clear->setEnabled( false );

    connect( m_up,     SIGNAL( clicked() ), m_listview, SLOT( moveSelectedUp() ) );
    connect( m_down,   SIGNAL( clicked() ), m_listview, SLOT( moveSelectedDown() ) );
    connect( m_remove, SIGNAL( clicked() ), this,       SLOT( removeSelected() ) );
    connect( m_add,    SIGNAL( clicked() ), this,       SLOT( addItems() ) );
    connect( m_clear,  SIGNAL( clicked() ), m_listview, SLOT( clear() ) );

    Playlist *pl = Playlist::instance();
    connect( pl,         SIGNAL( selectionChanged() ),    SLOT( updateButtons() ) );
    connect( m_listview, SIGNAL( selectionChanged() ),    SLOT( updateButtons() ) );
    connect( pl,         SIGNAL( queueChanged(const PLItemList &, const PLItemList &) ),
             SLOT( addQueuedItems(const PLItemList &, const PLItemList &) ) );

    insertItems();
}
Exemple #7
0
void K3bTempDirSelectionWidget::setNeededSize( KIO::filesize_t bytes )
{
  m_requestedSize = bytes;
  if( !m_labelCdSize ) {
    QHBox* cdSizeBox = new QHBox( this );
    cdSizeBox->setSpacing( KDialog::spacingHint() );
    (void)new QLabel( i18n( "Size of project:" ), cdSizeBox, "TextLabel4" );
    m_labelCdSize = new QLabel( KIO::convertSize(bytes), cdSizeBox, "m_labelCdSize" );
    m_labelCdSize->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
  }
  m_labelCdSize->setText( KIO::convertSize(bytes) );
}
Exemple #8
0
PreviewWidget::PreviewWidget( QWidget *parent )
    : QVBox( parent ), QFilePreview()
{
    setSpacing( 5 );
    setMargin( 5 );
    QHBox *row = new QHBox( this );
    row->setSpacing( 5 );
    (void)new QLabel( tr( "Only show files smaller than: " ), row );
    sizeSpinBox = new QSpinBox( 1, 10000, 1, row );
    sizeSpinBox->setSuffix( " KB" );
    sizeSpinBox->setValue( 64 );
    row->setFixedHeight( 10 + sizeSpinBox->sizeHint().height() );
    preview = new Preview( this );
}
//--------------------------------------------------------------------------------
RepeatRangeWindow::RepeatRangeWindow( QWidget* parent, const char* name )
  : QVBox( parent, name ? name : "RepeatRangeWindow" )
{
  setSpacing( 6 );

  _group = new QVButtonGroup( i18n("Times to Match"), this, "groupbox" );

  // Any number of times
  QRadioButton* radioBut = new QRadioButton(i18n("Any number of times (including zero times)"),
                                            _group,
                                            "RepeatRangeWindow::choice any times");

  _group->insert(radioBut, ANY);

  QWidget* container = new QWidget( _group );
  QHBoxLayout* lay = new QHBoxLayout( container );
  QGrid* grid = new QGrid( 3, container );
  grid->setSpacing( 5 );

  lay->addWidget( grid );
  lay->addStretch( 1 );

  createLine( grid, i18n( "At least" ), &_leastTimes, ATLEAST );
  createLine( grid, i18n( "At most" ), &_mostTimes, ATMOST );
  createLine( grid, i18n( "Exactly" ), &_exactlyTimes, EXACTLY );

  // from ___ to ___ times
  radioBut = new QRadioButton(i18n( "From" ), grid, "RepeatRangeWindow::from");
  _group->insert( radioBut, MINMAX );

  _rangeFrom = new QSpinBox( 1, 999, 1, grid);

  QHBox* box = new QHBox( grid );
  box->setSpacing( 5 );

  (void) new QLabel(i18n( "to" ), box);
  _rangeTo = new QSpinBox( 1, 999, 1, box );
  (void) new QLabel( i18n( "time(s)" ), box );

  connect( _rangeFrom, SIGNAL( valueChanged( int ) ), this, SLOT( slotUpdateMaxVal( int ) ) );
  connect( _rangeTo, SIGNAL( valueChanged( int ) ), this, SLOT( slotUpdateMinVal( int ) ) );

  // set a default button.
  _group->setButton(ANY);
  slotItemChange( ANY );


  connect( _group, SIGNAL( clicked( int ) ), this, SLOT( slotItemChange( int ) ) );
}
Exemple #10
0
void ApplicationWindow::finishGrid(QWidget *vbox, QGrid *grid, unsigned ctrl_class, bool odd)
{
	if (odd) {
		new QWidget(grid);
		new QWidget(grid);
	}
	QWidget *stretch = new QWidget(grid);
	stretch->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);

	QFrame *frame = new QFrame(vbox);
	frame->setFrameShape(QFrame::HLine);
	frame->setFrameShadow(QFrame::Sunken);
	frame->setMargin(3);

	QHBox *hbox = new QHBox(vbox);
	hbox->setSpacing(3);

	QCheckBox *cbox = new QCheckBox("Update on change", hbox);
	widgetMap[ctrl_class | CTRL_UPDATE_ON_CHANGE] = cbox;
	connect(cbox, SIGNAL(clicked()), sigMapper, SLOT(map()));
	sigMapper->setMapping(cbox, ctrl_class | CTRL_UPDATE_ON_CHANGE);

	stretch = new QWidget(hbox);
	stretch->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);

	QPushButton *defBut = new QPushButton("Set Defaults", hbox);
	widgetMap[ctrl_class | CTRL_DEFAULTS] = defBut;
	connect(defBut, SIGNAL(clicked()), sigMapper, SLOT(map()));
	sigMapper->setMapping(defBut, ctrl_class | CTRL_DEFAULTS);

	QPushButton *refreshBut = new QPushButton("Refresh", hbox);
	widgetMap[ctrl_class | CTRL_REFRESH] = refreshBut;
	connect(refreshBut, SIGNAL(clicked()), sigMapper, SLOT(map()));
	sigMapper->setMapping(refreshBut, ctrl_class | CTRL_REFRESH);

	QPushButton *button = new QPushButton("Update", hbox);
	widgetMap[ctrl_class | CTRL_UPDATE] = button;
	connect(button, SIGNAL(clicked()), sigMapper, SLOT(map()));
	sigMapper->setMapping(button, ctrl_class | CTRL_UPDATE);
	connect(cbox, SIGNAL(toggled(bool)), button, SLOT(setDisabled(bool)));

	cbox->setChecked(ctrl_class == V4L2_CTRL_CLASS_USER);

	refresh(ctrl_class);
}
Exemple #11
0
KACLEditWidget::KACLEditWidget(QWidget *parent, const char *name) : QWidget(parent, name)
{
    QHBox *hbox = new QHBox(parent);
    hbox->setSpacing(KDialog::spacingHint());
    m_listView = new KACLListView(hbox, "acl_listview");
    connect(m_listView, SIGNAL(selectionChanged()), this, SLOT(slotUpdateButtons()));
    QVBox *vbox = new QVBox(hbox);
    vbox->setSpacing(KDialog::spacingHint());
    m_AddBtn = new QPushButton(i18n("Add Entry..."), vbox, "add_entry_button");
    connect(m_AddBtn, SIGNAL(clicked()), m_listView, SLOT(slotAddEntry()));
    m_EditBtn = new QPushButton(i18n("Edit Entry..."), vbox, "edit_entry_button");
    connect(m_EditBtn, SIGNAL(clicked()), m_listView, SLOT(slotEditEntry()));
    m_DelBtn = new QPushButton(i18n("Delete Entry"), vbox, "delete_entry_button");
    connect(m_DelBtn, SIGNAL(clicked()), m_listView, SLOT(slotRemoveEntry()));
    QWidget *spacer = new QWidget(vbox);
    spacer->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
    slotUpdateButtons();
}
Exemple #12
0
KateSessionChooser::KateSessionChooser(QWidget *parent, const QString &lastSession)
    : KDialogBase(parent, "", true, i18n("Session Chooser"), KDialogBase::User1 | KDialogBase::User2 | KDialogBase::User3, KDialogBase::User2, true,
                  KStdGuiItem::quit(), KGuiItem(i18n("Open Session"), "fileopen"), KGuiItem(i18n("New Session"), "filenew"))
{
    QHBox *page = new QHBox(this);
    page->setMinimumSize(400, 200);
    setMainWidget(page);

    QHBox *hb = new QHBox(page);
    hb->setSpacing(KDialog::spacingHint());

    QLabel *label = new QLabel(hb);
    label->setPixmap(UserIcon("sessionchooser"));
    label->setFrameStyle(QFrame::Panel | QFrame::Sunken);

    QVBox *vb = new QVBox(hb);
    vb->setSpacing(KDialog::spacingHint());

    m_sessions = new KListView(vb);
    m_sessions->addColumn(i18n("Session Name"));
    m_sessions->addColumn(i18n("Open Documents"));
    m_sessions->setResizeMode(QListView::AllColumns);
    m_sessions->setSelectionMode(QListView::Single);
    m_sessions->setAllColumnsShowFocus(true);

    connect(m_sessions, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
    connect(m_sessions, SIGNAL(doubleClicked(QListViewItem *, const QPoint &, int)), this, SLOT(slotUser2()));

    KateSessionList &slist(KateSessionManager::self()->sessionList());
    for(unsigned int i = 0; i < slist.count(); ++i)
    {
        KateSessionChooserItem *item = new KateSessionChooserItem(m_sessions, slist[i]);

        if(slist[i]->sessionFileRelative() == lastSession)
            m_sessions->setSelected(item, true);
    }

    m_useLast = new QCheckBox(i18n("&Always use this choice"), vb);

    setResult(resultNone);

    // trigger action update
    selectionChanged();
}
BooleanLedColorPropertyWidget::BooleanLedColorPropertyWidget(const QString & text, bool withDefault, QWidget *parent, const char *name)
	:	QVButtonGroup(text, parent, name)
{
	
	if (withDefault)
	{
		m_defaultColor = new QCheckBox(i18n("Automatic colored"), this);
		Q_CHECK_PTR(m_defaultColor);
	}
	else
	{
		m_defaultColor = 0;
	}
	
	
	m_red = new QRadioButton(i18n("Red"), this);
	Q_CHECK_PTR(m_red);
	m_green = new QRadioButton(i18n("Green"), this);
	Q_CHECK_PTR(m_green);
	m_orange = new QRadioButton(i18n("Orange"), this);
	Q_CHECK_PTR(m_orange);
	
	QHBox * userBox = new QHBox(this);
	Q_CHECK_PTR(userBox);
	userBox->setSpacing(KDialog::spacingHint());
	
	QLabel * label = new QLabel(i18n("User defined:"),userBox);
	Q_CHECK_PTR(label);
	m_userColor = new KColorButton(userBox);;
	Q_CHECK_PTR(m_userColor);
	label->setBuddy(m_userColor);
	// TODO add ToolTip



	connect(m_red,SIGNAL(clicked()),this,SLOT(slotRed()));
	connect(m_green,SIGNAL(clicked()),this,SLOT(slotGreen()));
	connect(m_orange,SIGNAL(clicked()),this,SLOT(slotOrange()));
	connect(m_userColor,SIGNAL(changed(const QColor &)),this,SLOT(setColor(const QColor &)));
	if (m_defaultColor)
	{
		connect(m_defaultColor,SIGNAL(toggled(bool)),this,SLOT(slotDefault(bool)));
	}
}
Exemple #14
0
void KHelpMenu::aboutApplication()
{
  if (d->mAboutData)
  {
    if( !mAboutApp )
    {
      mAboutApp = new KAboutApplication( d->mAboutData, mParent, "about", false );
      connect( mAboutApp, SIGNAL(finished()), this, SLOT( dialogFinished()) );
    }
    mAboutApp->show();
  }
  else if( mAboutAppText.isEmpty() )
  {
    emit showAboutApplication();
  }
  else
  {
    if( !mAboutApp )
    {
      mAboutApp = new KDialogBase( QString::null, // Caption is defined below
				   KDialogBase::Yes, KDialogBase::Yes,
				   KDialogBase::Yes, mParent, "about",
				   false, true, KStdGuiItem::ok() );
      connect( mAboutApp, SIGNAL(finished()), this, SLOT( dialogFinished()) );

      QHBox *hbox = new QHBox( mAboutApp );
      mAboutApp->setMainWidget( hbox );
      hbox->setSpacing(KDialog::spacingHint()*3);
      hbox->setMargin(KDialog::marginHint()*1);

      QLabel *label1 = new QLabel(hbox);
      label1->setPixmap( kapp->icon() );
      QLabel *label2 = new QLabel(hbox);
      label2->setText( mAboutAppText );

      mAboutApp->setPlainCaption( i18n("About %1").arg(kapp->caption()) );
      mAboutApp->disableResize();
    }

    mAboutApp->show();
  }
}
Exemple #15
0
K3bTempDirSelectionWidget::K3bTempDirSelectionWidget( QWidget *parent, const char *name )
  : QGroupBox( 4, Qt::Vertical, parent, name ),
    m_labelCdSize(0),
    m_defaultImageFileName( "k3b_image.iso" )
{
  layout()->setSpacing( KDialog::spacingHint() );
  layout()->setMargin( KDialog::marginHint() );

  m_imageFileLabel = new QLabel( this );
  m_editDirectory = new KURLRequester( this, "m_editDirectory" );

  m_imageFileLabel->setBuddy( m_editDirectory );

  QHBox* freeTempSpaceBox = new QHBox( this );
  freeTempSpaceBox->setSpacing( KDialog::spacingHint() );
  (void)new QLabel( i18n( "Free space in temporary directory:" ), freeTempSpaceBox, "TextLabel2" );
  m_labelFreeSpace = new QLabel( "                       ",freeTempSpaceBox, "m_labelFreeSpace" );
  m_labelFreeSpace->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );


  connect( m_editDirectory, SIGNAL(openFileDialog(KURLRequester*)),
	   this, SLOT(slotTempDirButtonPressed(KURLRequester*)) );
  connect( m_editDirectory, SIGNAL(textChanged(const QString&)),
	   this, SLOT(slotUpdateFreeTempSpace()) );
  connect( m_editDirectory->lineEdit(), SIGNAL(lostFocus()),
           this, SLOT(slotFixTempPath()) );

  // choose a default
  setSelectionMode( DIR );

  m_editDirectory->setURL( K3b::defaultTempPath() );
  slotUpdateFreeTempSpace();

  // ToolTips
  // --------------------------------------------------------------------------------
  QToolTip::add( m_editDirectory, i18n("The directory in which to save the image files") );

  // What's This info
  // --------------------------------------------------------------------------------
  QWhatsThis::add( m_editDirectory, i18n("<p>This is the directory in which K3b will save the <em>image files</em>."
					 "<p>Please make sure that it resides on a partition that has enough free space.") );
}
Exemple #16
0
int main(int argc, char **argv) {
    QApplication app(argc, argv);

    QHBox *hbox = new QHBox();
    hbox->setMargin(10);
    hbox->setSpacing(10);

    DDLabel *lab1 = new DDLabel(hbox, DDLabel::Sor);
    lab1->setText("Drag the Content\nto the rightest\nand drop it");

    DDLabel *lab2 = new DDLabel(hbox, DDLabel::Sor);
    lab2->setPixmap(QPixmap("logo.jpg"));

    DDLabel *lab3 = new DDLabel(hbox, DDLabel::Des);
    lab3->setText("Drop here");

    app.setMainWidget(hbox);
    hbox->show();

    return app.exec();
}
// -------------------------------------------------------------------------------------------------
AboutDialog::AboutDialog(QWidget* parent, const char* name)
    throw ()
    : QDialog(parent, name)
{
     m_mainLayout = new QVBoxLayout(this, 10, 6);
    setCaption(tr("About The Fabulous Logic Analyzer"));
    
    // the top of the dialog
    QHBox* titleBox = new QHBox(this);
    QLabel* titleIcon = new QLabel(titleBox);
    titleIcon->setPixmap(QPixmap::fromMimeSource("tfla-01_32.png"));
    QLabel* titleText = new QLabel(tr("<p><b>The Fabulous Logic Analyzer "VERSION_STRING"</b></p>"),
            titleBox);
    titleBox->setStretchFactor(titleIcon, 0);
    titleBox->setStretchFactor(titleText, 5);
    titleBox->setSpacing(5);
    
    // the tab
    m_tabWidget = new QTabWidget(this);
    setupAboutTab();
    setupLicenseTab();
    
    // the ok Button
    QPushButton* okButton = new QPushButton(tr("&Close"), this, "Close button");
    okButton->setDefault(true);
    QWidget* filler = new QWidget(this);
    QHBoxLayout* buttonLayout = new QHBoxLayout(0, 0, 6);
    buttonLayout->addWidget(filler);
    buttonLayout->addWidget(okButton);
    buttonLayout->setStretchFactor(filler, 1);
    buttonLayout->setStretchFactor(okButton, 0);
    
    // main layout
    m_mainLayout->addWidget(titleBox);
    m_mainLayout->addWidget(m_tabWidget);
    m_mainLayout->addStretch(5);
    m_mainLayout->addLayout(buttonLayout);
    
    connect(okButton, SIGNAL(clicked()), SLOT(accept()));
}
Exemple #18
0
ManualDeviceAdder::ManualDeviceAdder( MediumPluginManager* mpm )
: KDialogBase( amaroK::mainWindow(), "manualdeviceadder", true, QString::null, Ok|Cancel, Ok )
{
    m_mpm = mpm;
    m_successful = false;

    kapp->setTopWidget( this );
    setCaption( kapp->makeStdCaption( i18n( "Add New Device") ) );

    QHBox* hbox = makeHBoxMainWidget();
    hbox->setSpacing( KDialog::spacingHint() );

    QVBox* vbox1 = new QVBox( hbox );

    new QLabel( i18n( "Select the plugin to use with this device:"), vbox1 );
    m_mdaCombo = new KComboBox( false, vbox1, "m_mdacombo" );
    m_mdaCombo->insertItem( i18n( "Do not handle" ) );
    for( KTrader::OfferList::ConstIterator it = MediaBrowser::instance()->getPlugins().begin();
            it != MediaBrowser::instance()->getPlugins().end();
            ++it )
        m_mdaCombo->insertItem( (*it)->name() );

    new QLabel( "", vbox1 );
    QLabel* nameLabel = new QLabel( vbox1 );
    nameLabel->setText( i18n( "Enter a &name for this device (required):" ) );
    m_mdaName = new HintLineEdit( QString::null, vbox1);
    nameLabel->setBuddy( m_mdaName );
    m_mdaName->setHint( i18n( "Example: My_Ipod" ) );
    QToolTip::add( m_mdaName, i18n( "Enter a name for the device.  The name must be unique across all devices, including autodetected devices.  It must not contain the pipe ( | ) character." ) );

    new QLabel( "", vbox1 );
    QLabel* mpLabel = new QLabel( vbox1 );
    mpLabel->setText( i18n( "Enter the &mount point of the device, if applicable:" ) );
    m_mdaMountPoint = new HintLineEdit( QString::null, vbox1);
    mpLabel->setBuddy( m_mdaMountPoint );
    m_mdaMountPoint->setHint( i18n( "Example: /mnt/ipod" ) );
    QToolTip::add( m_mdaMountPoint, i18n( "Enter the device's mount point.  Some devices (such as iRiver iFP devices) may not have a mount point and this can be ignored.  All other devices (iPods, UMS/VFAT devices) should enter the mount point here." ) );

    connect( m_mdaCombo, SIGNAL( activated(const QString&) ), this, SLOT( comboChanged(const QString&) ) );
}
Exemple #19
0
KateSessionManageDialog::KateSessionManageDialog(QWidget *parent)
    : KDialogBase(parent, "", true, i18n("Manage Sessions"), KDialogBase::User1, KDialogBase::User1, false, KStdGuiItem::close())
{
    QHBox *page = new QHBox(this);
    page->setMinimumSize(400, 200);
    setMainWidget(page);

    QHBox *hb = new QHBox(page);
    hb->setSpacing(KDialog::spacingHint());

    m_sessions = new KListView(hb);
    m_sessions->addColumn(i18n("Session Name"));
    m_sessions->addColumn(i18n("Open Documents"));
    m_sessions->setResizeMode(QListView::AllColumns);
    m_sessions->setSelectionMode(QListView::Single);
    m_sessions->setAllColumnsShowFocus(true);

    connect(m_sessions, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));

    updateSessionList();

    QWidget *vb = new QWidget(hb);
    QVBoxLayout *vbl = new QVBoxLayout(vb);
    vbl->setSpacing(KDialog::spacingHint());

    m_rename = new KPushButton(i18n("&Rename..."), vb);
    connect(m_rename, SIGNAL(clicked()), this, SLOT(rename()));
    vbl->addWidget(m_rename);

    m_del = new KPushButton(KStdGuiItem::del(), vb);
    connect(m_del, SIGNAL(clicked()), this, SLOT(del()));
    vbl->addWidget(m_del);

    vbl->addStretch();

    // trigger action update
    selectionChanged();
}
BooleanLedPropertyWidget::BooleanLedPropertyWidget(Component * comp, QWidget *parent, const char *name)
	:	ComponentPropertyBaseWidget(comp, 1, parent, name)
{
	m_onColor = new BooleanLedColorPropertyWidget(i18n("Color On"), false, this);
	Q_CHECK_PTR(m_onColor);
	
	m_offColor = new BooleanLedColorPropertyWidget(i18n("Color Off"), true, this);
	Q_CHECK_PTR(m_offColor);

	QHBox * exampleBox = new QHBox(this);
	Q_CHECK_PTR(exampleBox);
	exampleBox->setSpacing(KDialog::spacingHint());
	
	QLabel * label = new QLabel(i18n("Result:"),exampleBox);
	Q_CHECK_PTR(label);
	label = new QLabel(i18n("On"),exampleBox);
	Q_CHECK_PTR(label);
	m_exampleOn = new KLed(exampleBox);;
	m_exampleOn->setFixedSize(20,20);
	Q_CHECK_PTR(m_exampleOn);
	
	label = new QLabel(i18n("Off"),exampleBox);
	Q_CHECK_PTR(label);
	m_exampleOff = new KLed(exampleBox);
	m_exampleOff->setFixedSize(20,20);
	Q_CHECK_PTR(m_exampleOff);
	
	connect(m_onColor, SIGNAL(changed(const QColor &)), this, SLOT(slotOnColor(const QColor &)));
	connect(m_offColor, SIGNAL(changed(const QColor &)), this, SLOT(slotOffColor(const QColor &)));
 		
	
	m_onColor->setColor(((BooleanLed*)comp)->getOnColor());
	m_offColor->setColor(((BooleanLed*)comp)->getOffColor());
	m_exampleOn->on();
	slotOnColor(m_onColor->color());
	slotOffColor(m_offColor->color());
	
}
Exemple #21
0
CharacterSelectorView::CharacterSelectorView(KBCatalog* catalog,QWidget *parent, Project::Ptr project)
    : KBCatalogView(catalog,parent,project)
{
    QVBoxLayout* layout = new QVBoxLayout( this );
    layout->setResizeMode( QLayout::Minimum );

    layout->setSpacing( KDialog::spacingHint() );
    
    QHBox* bar = new QHBox(this);
    bar->setSpacing( KDialog::spacingHint() );
    layout->addWidget (bar);
    
    QLabel *lTable = new QLabel( i18n( "Table:" ), bar );
    _tableNum = new QSpinBox( 0, 255, 1, bar );
    lTable->setBuddy( _tableNum );
    bar->setStretchFactor( _tableNum, 1 );
    
    QScrollView* scroll = new QScrollView( this );    
    _table = new KCharSelectTable(scroll,"charselector","helvetica",' ',0);
    _table->setNumCols(16);
    _table->setNumRows(16);
    
    scroll->addChild(_table);
    layout->addWidget (scroll);
    
    connect( _table, SIGNAL( doubleClicked() ), this, SLOT( emitChar() ) );
    connect( _tableNum, SIGNAL( valueChanged(int) ), this, SLOT( setTab(int) ));
    
    connect( _catalog, SIGNAL( signalFileOpened(bool) ), this, SLOT (setDisabled (bool)));
    connect( _catalog, SIGNAL( signalFileOpened(bool) ), _table, SLOT (setDisabled (bool)));

    QWhatsThis::add(this,
       i18n("<qt><p><b>Character Selector</b></p>"
         "<p>This tool allows to insert special characters using "
         "double click.</p></qt>"));
}
Exemple #22
0
SoundDlg::SoundDlg(const QString &file, float volume, float fadeVolume, int fadeSeconds, bool repeat,
                   const QString &caption, QWidget *parent, const char *name)
    : KDialogBase(parent, name, true, caption, Ok | Cancel, Ok, false),
      mReadOnly(false),
      mArtsDispatcher(0),
      mPlayObject(0),
      mPlayTimer(0)
{
    QWidget *page = new QWidget(this);
    setMainWidget(page);
    QVBoxLayout *layout = new QVBoxLayout(page, 0, spacingHint());

    // File play button
    QHBox *box = new QHBox(page);
    layout->addWidget(box);
    mFilePlay = new QPushButton(box);
    mFilePlay->setPixmap(SmallIcon("player_play"));
    mFilePlay->setFixedSize(mFilePlay->sizeHint());
    connect(mFilePlay, SIGNAL(clicked()), SLOT(playSound()));
    QToolTip::add(mFilePlay, i18n("Test the sound"));
    QWhatsThis::add(mFilePlay, i18n("Play the selected sound file."));

    // File name edit box
    mFileEdit = new LineEdit(LineEdit::Url, box);
    mFileEdit->setAcceptDrops(true);
    QWhatsThis::add(mFileEdit, i18n("Enter the name or URL of a sound file to play."));

    // File browse button
    mFileBrowseButton = new PushButton(box);
    mFileBrowseButton->setPixmap(SmallIcon("fileopen"));
    mFileBrowseButton->setFixedSize(mFileBrowseButton->sizeHint());
    connect(mFileBrowseButton, SIGNAL(clicked()), SLOT(slotPickFile()));
    QToolTip::add(mFileBrowseButton, i18n("Choose a file"));
    QWhatsThis::add(mFileBrowseButton, i18n("Select a sound file to play."));

    // Sound repetition checkbox
    mRepeatCheckbox = new CheckBox(i18n_p_Repeat(), page);
    mRepeatCheckbox->setFixedSize(mRepeatCheckbox->sizeHint());
    QWhatsThis::add(mRepeatCheckbox,
                    i18n("If checked, the sound file will be played repeatedly for as long as the message is displayed."));
    layout->addWidget(mRepeatCheckbox);

    // Volume
    QGroupBox *group = new QGroupBox(i18n("Volume"), page);
    layout->addWidget(group);
    QGridLayout *grid = new QGridLayout(group, 4, 3, marginHint(), spacingHint());
    grid->addRowSpacing(0, fontMetrics().height() - marginHint() + spacingHint());
    grid->setColStretch(2, 1);
    int indentWidth = 3 * KDialog::spacingHint();
    grid->addColSpacing(0, indentWidth);
    grid->addColSpacing(1, indentWidth);
    // Get alignment to use in QGridLayout (AlignAuto doesn't work correctly there)
    int alignment = QApplication::reverseLayout() ? Qt::AlignRight : Qt::AlignLeft;

    // 'Set volume' checkbox
    box = new QHBox(group);
    box->setSpacing(spacingHint());
    grid->addMultiCellWidget(box, 1, 1, 0, 2);
    mVolumeCheckbox = new CheckBox(i18n_v_SetVolume(), box);
    mVolumeCheckbox->setFixedSize(mVolumeCheckbox->sizeHint());
    connect(mVolumeCheckbox, SIGNAL(toggled(bool)), SLOT(slotVolumeToggled(bool)));
    QWhatsThis::add(mVolumeCheckbox,
                    i18n("Select to choose the volume for playing the sound file."));

    // Volume slider
    mVolumeSlider = new Slider(0, 100, 10, 0, Qt::Horizontal, box);
    mVolumeSlider->setTickmarks(QSlider::Below);
    mVolumeSlider->setTickInterval(10);
    mVolumeSlider->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
    QWhatsThis::add(mVolumeSlider, i18n("Choose the volume for playing the sound file."));
    mVolumeCheckbox->setFocusWidget(mVolumeSlider);

    // Fade checkbox
    mFadeCheckbox = new CheckBox(i18n("Fade"), group);
    mFadeCheckbox->setFixedSize(mFadeCheckbox->sizeHint());
    connect(mFadeCheckbox, SIGNAL(toggled(bool)), SLOT(slotFadeToggled(bool)));
    QWhatsThis::add(mFadeCheckbox,
                    i18n("Select to fade the volume when the sound file first starts to play."));
    grid->addMultiCellWidget(mFadeCheckbox, 2, 2, 1, 2, alignment);

    // Fade time
    mFadeBox = new QHBox(group);
    mFadeBox->setSpacing(spacingHint());
    grid->addWidget(mFadeBox, 3, 2, alignment);
    QLabel *label = new QLabel(i18n("Time period over which to fade the sound", "Fade time:"), mFadeBox);
    label->setFixedSize(label->sizeHint());
    mFadeTime = new SpinBox(1, 999, 1, mFadeBox);
    mFadeTime->setLineShiftStep(10);
    mFadeTime->setFixedSize(mFadeTime->sizeHint());
    label->setBuddy(mFadeTime);
    label = new QLabel(i18n("seconds"), mFadeBox);
    label->setFixedSize(label->sizeHint());
    QWhatsThis::add(mFadeBox, i18n("Enter how many seconds to fade the sound before reaching the set volume."));

    // Fade slider
    mFadeVolumeBox = new QHBox(group);
    mFadeVolumeBox->setSpacing(spacingHint());
    grid->addWidget(mFadeVolumeBox, 4, 2);
    label = new QLabel(i18n("Initial volume:"), mFadeVolumeBox);
    label->setFixedSize(label->sizeHint());
    mFadeSlider = new Slider(0, 100, 10, 0, Qt::Horizontal, mFadeVolumeBox);
    mFadeSlider->setTickmarks(QSlider::Below);
    mFadeSlider->setTickInterval(10);
    mFadeSlider->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
    label->setBuddy(mFadeSlider);
    QWhatsThis::add(mFadeVolumeBox, i18n("Choose the initial volume for playing the sound file."));

    // Restore the dialogue size from last time
    QSize s;
    if(KAlarm::readConfigWindowSize(SOUND_DIALOG_NAME, s))
        resize(s);

    // Initialise the control values
    mFileEdit->setText(file);
    mRepeatCheckbox->setChecked(repeat);
    mVolumeCheckbox->setChecked(volume >= 0);
    mVolumeSlider->setValue(volume >= 0 ? static_cast<int>(volume * 100) : 100);
    mFadeCheckbox->setChecked(fadeVolume >= 0);
    mFadeSlider->setValue(fadeVolume >= 0 ? static_cast<int>(fadeVolume * 100) : 100);
    mFadeTime->setValue(fadeSeconds);
    slotVolumeToggled(volume >= 0);
}
BookmarksSettingsPage::BookmarksSettingsPage(QWidget*parent) :
    SettingsPageBase(parent),
    m_addButton(0),
    m_removeButton(0),
    m_moveUpButton(0),
    m_moveDownButton(0)
{
    QVBoxLayout* topLayout = new QVBoxLayout(parent, 2, KDialog::spacingHint());

    const int spacing = KDialog::spacingHint();

    QHBox* hBox = new QHBox(parent);
    hBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
    hBox->setSpacing(spacing);
    hBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored);

    m_listView = new KListView(hBox);
    m_listView->addColumn(i18n("Icon"));
    m_listView->addColumn(i18n("Name"));
    m_listView->addColumn(i18n("Location"));
    m_listView->setResizeMode(QListView::LastColumn);
    m_listView->setColumnAlignment(0, Qt::AlignHCenter);
    m_listView->setAllColumnsShowFocus(true);
    m_listView->setSorting(-1);
    connect(m_listView, SIGNAL(selectionChanged()),
            this, SLOT(updateButtons()));
    connect(m_listView, SIGNAL(pressed(QListViewItem*)),
            this, SLOT(slotBookmarkPressed(QListViewItem*)));
    connect(m_listView, SIGNAL(doubleClicked(QListViewItem*, const QPoint&, int)),
            this, SLOT(slotBookmarkDoubleClicked(QListViewItem*, const QPoint&, int)));

    QVBox* buttonBox = new QVBox(hBox);
    buttonBox->setSpacing(spacing);

    const QSizePolicy buttonSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);

    m_addButton = new KPushButton(i18n("Add..."), buttonBox);
    connect(m_addButton, SIGNAL(clicked()),
            this, SLOT(slotAddButtonClicked()));
    m_addButton->setSizePolicy(buttonSizePolicy);

    m_editButton = new KPushButton(i18n("Edit..."), buttonBox);
    connect(m_editButton, SIGNAL(clicked()),
            this, SLOT(slotEditButtonClicked()));
    m_editButton->setSizePolicy(buttonSizePolicy);

    m_removeButton = new KPushButton(i18n("Remove"), buttonBox);
    connect(m_removeButton, SIGNAL(clicked()),
            this, SLOT(slotRemoveButtonClicked()));
    m_removeButton->setSizePolicy(buttonSizePolicy);

    m_moveUpButton = new KPushButton(i18n("Move Up"), buttonBox);
    connect(m_moveUpButton, SIGNAL(clicked()),
            this, SLOT(slotMoveUpButtonClicked()));
    m_moveUpButton->setSizePolicy(buttonSizePolicy);

    m_moveDownButton = new KPushButton(i18n("Move Down"), buttonBox);
    connect(m_moveDownButton, SIGNAL(clicked()),
            this, SLOT(slotMoveDownButtonClicked()));
    m_moveDownButton->setSizePolicy(buttonSizePolicy);

    // Add a dummy widget with no restriction regarding a vertical resizing.
    // This assures that the spacing between the buttons is not increased.
    new QWidget(buttonBox);

    topLayout->addWidget(hBox);

    // insert all editable bookmarks.
    KBookmarkGroup root = DolphinSettings::instance().bookmarkManager()->root();
    KBookmark bookmark = root.first();

    QListViewItem* prev = 0;
    while (!bookmark.isNull()) {
        QListViewItem* item = new QListViewItem(m_listView);
        item->setPixmap(PixmapIdx, SmallIcon(bookmark.icon()));
        item->setText(NameIdx, bookmark.text());
        item->setText(URLIdx, bookmark.url().prettyURL());

        // add hidden column to be able to retrieve the icon name again
        item->setText(IconIdx, bookmark.icon());

        m_listView->insertItem(item);
        if (prev != 0) {
            item->moveItem(prev);
        }
        prev = item;

        bookmark = root.next(bookmark);
    }
    m_listView->setSelected(m_listView->firstChild(), true);

    updateButtons();
}
Exemple #24
0
/* Constructor setups the GUI. */
QucsLib::QucsLib()
{
  // set application icon
  setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm"));
  setCaption("Qucs Library Tool " PACKAGE_VERSION);

  QMenuBar * menuBar = new QMenuBar (this);

  // create file menu
  QPopupMenu * fileMenu = new QPopupMenu ();
  QAction * manageLib =
    new QAction ("Manage User Libraries...", tr("Manage User &Libraries..."), CTRL+Key_M, this);
  manageLib->addTo (fileMenu);
  connect(manageLib, SIGNAL(activated()), SLOT(slotManageLib()));

  fileMenu->insertSeparator();

  QAction * fileQuit =
    new QAction ("Quit", tr("&Quit"), CTRL+Key_Q, this);
  fileQuit->addTo (fileMenu);
  connect(fileQuit, SIGNAL(activated()), SLOT(slotQuit()));

  // create help menu
  QPopupMenu * helpMenu = new QPopupMenu ();
  QAction * helpHelp =
    new QAction (tr("Help"), tr("&Help"), Key_F1, this);
  helpHelp->addTo (helpMenu);
  connect(helpHelp, SIGNAL(activated()), SLOT(slotHelp()));
  QAction * helpAbout =
    new QAction (tr("About"), tr("About"), 0, helpMenu);
  helpAbout->addTo (helpMenu);
  connect(helpAbout, SIGNAL(activated()), SLOT(slotAbout()));

  // setup menu bar
  menuBar->insertItem (tr("&File"), fileMenu);
  menuBar->insertSeparator ();
  menuBar->insertItem (tr("&Help"), helpMenu);

  // main box
  QVBoxLayout * all = new QVBoxLayout (this);
  all->setSpacing (0);
  all->setMargin (0);

  // reserve space for menubar
  QWidget * Space = new QWidget (this);
  Space->setFixedSize(5, menuBar->height() + 2);
  all->addWidget (Space);

  // main layout
  QHBox * h = new QHBox (this);
  h->setSpacing (5);
  h->setMargin (3);
  all->addWidget (h);

  // library and component choice
  QVGroupBox * LibGroup = new QVGroupBox (tr("Component Selection"), h);
  Library = new QComboBox (LibGroup);
  connect(Library, SIGNAL(activated(int)), SLOT(slotSelectLibrary(int)));
  CompList = new QListBox(LibGroup);
  connect(CompList, SIGNAL(highlighted(QListBoxItem*)),
	SLOT(slotShowComponent(QListBoxItem*)));

  QHBox * h1 = new QHBox (LibGroup);
  QPushButton * SearchButton = new QPushButton (tr("Search..."), h1);
  connect(SearchButton, SIGNAL(clicked()), SLOT(slotSearchComponent()));
  h1->setStretchFactor(new QWidget(h1), 5); // stretchable placeholder


  // component display
  QVGroupBox *CompGroup = new QVGroupBox (tr("Component"), h);
  CompDescr = new QTextEdit(CompGroup);
  CompDescr->setTextFormat(Qt::PlainText);
  CompDescr->setReadOnly(true);
  CompDescr->setWordWrap(QTextEdit::NoWrap);

  Symbol = new SymbolWidget (CompGroup);

  QHBox * h2 = new QHBox (CompGroup);
  QPushButton * CopyButton = new QPushButton (tr("Copy to clipboard"), h2);
  connect(CopyButton, SIGNAL(clicked()), SLOT(slotCopyToClipBoard()));
  QPushButton * ShowButton = new QPushButton (tr("Show Model"), h2);
  connect(ShowButton, SIGNAL(clicked()), SLOT(slotShowModel()));

  // ......................................................
  putLibrariesIntoCombobox();
}
Exemple #25
0
FontColourChooser::FontColourChooser(QWidget *parent, const char *name,
                                     bool onlyFixed, const QStringList &fontList,
                                     const QString &frameLabel, bool editColours, bool fg, bool defaultFont,
                                     int visibleListSize)
    : QWidget(parent, name),
      mFgColourButton(0),
      mRemoveColourButton(0),
      mColourList(Preferences::messageColours()),
      mReadOnly(false)
{
    QVBoxLayout *topLayout = new QVBoxLayout(this, 0, KDialog::spacingHint());
    QWidget *page = this;
    if(!frameLabel.isNull())
    {
        page = new QGroupBox(frameLabel, this);
        topLayout->addWidget(page);
        topLayout = new QVBoxLayout(page, KDialog::marginHint(), KDialog::spacingHint());
        topLayout->addSpacing(fontMetrics().height() - KDialog::marginHint() + KDialog::spacingHint());
    }
    QHBoxLayout *hlayout = new QHBoxLayout(topLayout);
    QVBoxLayout *colourLayout = new QVBoxLayout(hlayout);
    if(fg)
    {
        QHBox *box = new QHBox(page);    // to group widgets for QWhatsThis text
        box->setSpacing(KDialog::spacingHint() / 2);
        colourLayout->addWidget(box);

        QLabel *label = new QLabel(i18n("&Foreground color:"), box);
        box->setStretchFactor(new QWidget(box), 0);
        mFgColourButton = new ColourCombo(box);
        connect(mFgColourButton, SIGNAL(activated(const QString &)), SLOT(setSampleColour()));
        label->setBuddy(mFgColourButton);
        QWhatsThis::add(box, i18n("Select the alarm message foreground color"));
    }

    QHBox *box = new QHBox(page);    // to group widgets for QWhatsThis text
    box->setSpacing(KDialog::spacingHint() / 2);
    colourLayout->addWidget(box);

    QLabel *label = new QLabel(i18n("&Background color:"), box);
    box->setStretchFactor(new QWidget(box), 0);
    mBgColourButton = new ColourCombo(box);
    connect(mBgColourButton, SIGNAL(activated(const QString &)), SLOT(setSampleColour()));
    label->setBuddy(mBgColourButton);
    QWhatsThis::add(box, i18n("Select the alarm message background color"));
    hlayout->addStretch();

    if(editColours)
    {
        QHBoxLayout *layout = new QHBoxLayout(topLayout);
        QPushButton *button = new QPushButton(i18n("Add Co&lor..."), page);
        button->setFixedSize(button->sizeHint());
        connect(button, SIGNAL(clicked()), SLOT(slotAddColour()));
        QWhatsThis::add(button, i18n("Choose a new color to add to the color selection list."));
        layout->addWidget(button);

        mRemoveColourButton = new QPushButton(i18n("&Remove Color"), page);
        mRemoveColourButton->setFixedSize(mRemoveColourButton->sizeHint());
        connect(mRemoveColourButton, SIGNAL(clicked()), SLOT(slotRemoveColour()));
        QWhatsThis::add(mRemoveColourButton,
                        i18n("Remove the color currently shown in the background color chooser, from the color selection list."));
        layout->addWidget(mRemoveColourButton);
    }

    if(defaultFont)
    {
        QHBoxLayout *layout = new QHBoxLayout(topLayout);
        mDefaultFont = new CheckBox(i18n("Use &default font"), page);
        mDefaultFont->setMinimumSize(mDefaultFont->sizeHint());
        connect(mDefaultFont, SIGNAL(toggled(bool)), SLOT(slotDefaultFontToggled(bool)));
        QWhatsThis::add(mDefaultFont,
                        i18n("Check to use the default font current at the time the alarm is displayed."));
        layout->addWidget(mDefaultFont);
        layout->addWidget(new QWidget(page));    // left adjust the widget
    }
    else
        mDefaultFont = 0;

    mFontChooser = new KFontChooser(page, name, onlyFixed, fontList, false, visibleListSize);
    mFontChooser->installEventFilter(this);   // for read-only mode
    const QObjectList *kids = mFontChooser->queryList();
    for(QObjectList::ConstIterator it = kids->constBegin();  it != kids->constEnd();  ++it)
        (*it)->installEventFilter(this);
    topLayout->addWidget(mFontChooser);

    slotDefaultFontToggled(false);
}
GeneralSettingsPage::GeneralSettingsPage(QWidget* parent) :
    SettingsPageBase(parent),
    m_homeURL(0),
    m_startSplit(0),
    m_startEditable(0)
{
    QVBoxLayout* topLayout = new QVBoxLayout(parent, 2, KDialog::spacingHint());

    const int spacing = KDialog::spacingHint();
    const int margin = KDialog::marginHint();
    const QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);

    DolphinSettings& settings = DolphinSettings::instance();

    QVBox* vBox = new QVBox(parent);
    vBox->setSizePolicy(sizePolicy);
    vBox->setSpacing(spacing);
    vBox->setMargin(margin);
    vBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored);

    // create 'Home URL' editor
    QGroupBox* homeGroup = new QGroupBox(1, Qt::Horizontal, i18n("Home URL"), vBox);
    homeGroup->setSizePolicy(sizePolicy);
    homeGroup->setMargin(margin);

    QHBox* homeURLBox = new QHBox(homeGroup);
    homeURLBox->setSizePolicy(sizePolicy);
    homeURLBox->setSpacing(spacing);

    new QLabel(i18n("Location:"), homeURLBox);
    m_homeURL = new QLineEdit(settings.homeURL().prettyURL(), homeURLBox);

    QPushButton* selectHomeURLButton = new QPushButton(SmallIcon("folder"), QString::null, homeURLBox);
    connect(selectHomeURLButton, SIGNAL(clicked()),
            this, SLOT(selectHomeURL()));

    QHBox* buttonBox = new QHBox(homeGroup);
    buttonBox->setSizePolicy(sizePolicy);
    buttonBox->setSpacing(spacing);
    QPushButton* useCurrentButton = new QPushButton(i18n("Use current location"), buttonBox);
    connect(useCurrentButton, SIGNAL(clicked()),
            this, SLOT(useCurrentLocation()));
    QPushButton* useDefaultButton = new QPushButton(i18n("Use default location"), buttonBox);
    connect(useDefaultButton, SIGNAL(clicked()),
            this, SLOT(useDefaulLocation()));

    // create 'Default View Mode' group
    QButtonGroup* buttonGroup = new QButtonGroup(3, Qt::Vertical, i18n("Default View Mode"), vBox);
    buttonGroup->setSizePolicy(sizePolicy);
    buttonGroup->setMargin(margin);

    m_iconsView = new QRadioButton(i18n("Icons"), buttonGroup);
    m_detailsView = new QRadioButton(i18n("Details"), buttonGroup);
    m_previewsView = new QRadioButton(i18n("Previews"), buttonGroup);

    switch (settings.defaultViewMode()) {
        case DolphinView::IconsView:    m_iconsView->setChecked(true); break;
        case DolphinView::DetailsView:  m_detailsView->setChecked(true); break;
        case DolphinView::PreviewsView: m_previewsView->setChecked(true); break;
    }

    // create 'Start with split view' checkbox
    m_startSplit = new QCheckBox(i18n("Start with split view"), vBox);
    m_startSplit->setChecked(settings.isViewSplit());

    // create 'Start with editable navigation bar' checkbox
    m_startEditable = new QCheckBox(i18n("Start with editable navigation bar"), vBox);
    m_startEditable->setChecked(settings.isURLEditable());

    // create 'Save view properties for each folder' checkbox
    m_saveView = new QCheckBox(i18n("Save view properties for each folder"), vBox);
    m_saveView->setChecked(settings.isSaveView());

    // Add a dummy widget with no restriction regarding
    // a vertical resizing. This assures that the dialog layout
    // is not stretched vertically.
    new QWidget(vBox);

    topLayout->addWidget(vBox);
}
void SimpleUI::setupCentralWidget()
{
    QVBox *npWidget = new QVBox( this );
    npWidget->setMargin( 0 );
    npWidget->setSpacing( 0 );

    positionLabel = new QLabel( statusBar() );
    positionLabel->setAlignment( AlignVCenter | AlignCenter );
    positionLabel->setFixedSize( fontMetrics().size( 0, " 00:00/00:00 " ) );
    statusBar()->addWidget( positionLabel, 0, true );

    video = new VideoFrame( npWidget );
    connect( video, SIGNAL(adaptSize(int,int)),
         SLOT(slotAdaptSize(int,int)) );
    connect( video, SIGNAL(rightButtonPressed(const QPoint &)),
         SLOT(slotContextMenu(const QPoint &)) );

    QHBox *ctlFrame = new QHBox( npWidget );
    ctlFrame->setFixedHeight( 38 );
    ctlFrame->setFrameShape( QFrame::StyledPanel );
    ctlFrame->setFrameShadow( QFrame::Raised );
    ctlFrame->setMargin( 6 );
    ctlFrame->setSpacing( 6 );

    QPushButton *backButton = new QPushButton( ctlFrame );
    backButton->setFixedSize( 24, 24 );
    backButton->setPixmap( QPixmap( back_xpm ) );
    QToolTip::add( backButton, i18n("Back") );
    connect( backButton, SIGNAL(clicked()), napp->player(), SLOT(back()) );

    stopButton = new QPushButton( ctlFrame );
    stopButton->setFixedSize( 24, 24 );
    stopButton->setPixmap( QPixmap( stop_xpm ) );
    QToolTip::add( stopButton, i18n("Stop") );
    connect( stopButton, SIGNAL(clicked()), napp->player(), SLOT(stop()) );

    playButton = new QPushButton( ctlFrame );
    playButton->setFixedSize( 24, 24 );
    playButton->setPixmap( QPixmap( play_xpm ) );
    QToolTip::add( playButton, i18n("Play / Pause") );
    connect( playButton, SIGNAL(clicked()), napp->player(), SLOT(playpause()) );

    QPushButton *forwButton = new QPushButton( ctlFrame );
    forwButton->setFixedSize( 24, 24 );
    forwButton->setPixmap( QPixmap( forward_xpm ) );
    QToolTip::add( forwButton, i18n("Forward") );
    connect( forwButton, SIGNAL(clicked()), napp->player(), SLOT(forward()) );

    slider = new L33tSlider( 0, 1000, 10, 0, L33tSlider::Horizontal, ctlFrame );
    slider->setFixedHeight( 24 );
    slider->setMinimumWidth( 100 );
    slider->setTickmarks( QSlider::NoMarks );
    connect( slider, SIGNAL(userChanged(int)), SLOT(slotSkipTo(int)) );
    connect( slider, SIGNAL(sliderMoved(int)), SLOT(slotSliderMoved(int)) );

    QPushButton *playlistButton = new QPushButton( ctlFrame );
    playlistButton->setFixedSize( 24, 24 );
    playlistButton->setPixmap( QPixmap( playlist_xpm ) );
    QToolTip::add( playlistButton, i18n("Playlist") );
    connect( playlistButton, SIGNAL(clicked()), napp->player(), SLOT(toggleListView()) );

    volumeButton = new QPushButton( ctlFrame );
    volumeButton->setFixedSize( 24, 24 );
    volumeButton->setPixmap( QPixmap( volume_xpm ) );
    QToolTip::add( volumeButton, i18n("Volume") );

    volumeFrame = new QVBox( this, "Volume", WStyle_Customize | WType_Popup );
    volumeFrame->setFrameStyle( QFrame::PopupPanel );
    volumeFrame->setMargin( 4 );

    volumeLabel = new QLabel( volumeFrame );
    volumeLabel->setText( "100%" );
    volumeLabel->setAlignment( AlignCenter );
    volumeLabel->setFixedSize( volumeLabel->sizeHint() );

    QHBox *volumeSubFrame = new QHBox( volumeFrame );
    volumeSlider = new L33tSlider( 0, 100, 10, 0, Vertical, volumeSubFrame );
    volumeSlider->setValue( 100 - napp->player()->volume() );
    volumeSlider->setFixedSize( volumeSlider->sizeHint() );

    volumeFrame->resize( volumeFrame->sizeHint() );

    connect( volumeSlider, SIGNAL(sliderMoved(int)), SLOT(slotVolumeSliderMoved(int)) );
    connect( volumeSlider, SIGNAL(userChanged(int)), SLOT(slotVolumeSliderMoved(int)) );
    connect( volumeButton, SIGNAL(clicked()), SLOT(slotVolumeFrame()) );

    setCentralWidget( npWidget );

    video->setMinimumSize( minimumSizeHint().width(), 1 );

    // Create properties dialog
    propertiesDialog = new PropertiesDialog( this );
    propertiesDialog->resize( 375, 285 );
}
Exemple #28
0
void KPrPgConfDia::setupPageSlides()
{
    QFrame* slidesPage = addPage( i18n("&Slides") );
    QWhatsThis::add( slidesPage, i18n("<p>This dialog allows you to configure which slides "
				      "are used in the presentation. Slides that are not "
				      "selected will not be displayed during the slide "
				      "show.</p>") );
    QGridLayout *slidesLayout = new QGridLayout( slidesPage,7 , 2, 0, KDialog::spacingHint());


    QButtonGroup *group=new QVButtonGroup( slidesPage );
    group->setRadioButtonExclusive( true );

    m_customSlide = new QRadioButton( i18n( "Custom slide show" ), group, "customslide" );

    connect( m_customSlide, SIGNAL( clicked () ), this, SLOT( radioButtonClicked() ) );

    QHBox *box = new QHBox( group );

    m_labelCustomSlide = new QLabel( i18n( "Custom slide:" ),box );

    m_customSlideCombobox = new QComboBox( box );
    m_customSlideCombobox->insertStringList( m_doc->presentationList() );

    m_selectedSlide = new QRadioButton( i18n( "Selected pages:" ), group, "selectedslide" );
    slidesLayout->addMultiCellWidget( group, 0,2,0,1 );
    connect( m_selectedSlide, SIGNAL( clicked () ), this, SLOT( radioButtonClicked() ) );

    slides = new QListView( slidesPage );
    slidesLayout->addMultiCellWidget( slides, 3, 3, 0, 1 );
    slidesLayout->setRowStretch( 3, 10 );
    slides->addColumn( i18n("Slide") );
    slides->setSorting( -1 );
    slides->header()->hide();

    for ( int i = m_doc->getPageNums() - 1; i >= 0; --i )
    {
        KPrPage *page=m_doc->pageList().at( i );
        QCheckListItem* item = new QCheckListItem( slides,
                                                   page->pageTitle(),
                                                   QCheckListItem::CheckBox );
        item->setOn( page->isSlideSelected() );
    }

    QHBox* buttonGroup = new QHBox( slidesPage );
    buttonGroup->setSpacing( KDialog::spacingHint() );

    QPushButton* selectAllButton = new QPushButton( i18n( "Select &All" ), buttonGroup );
    connect( selectAllButton, SIGNAL( clicked() ), this, SLOT( selectAllSlides() ) );

    QPushButton* deselectAllButton = new QPushButton( i18n( "&Deselect All" ), buttonGroup );
    connect( deselectAllButton, SIGNAL( clicked() ), this, SLOT( deselectAllSlides() ) );

    QWidget* spacer = new QWidget( buttonGroup );

    spacer->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) );
    slidesLayout->addMultiCellWidget( buttonGroup, 4, 4, 0, 1 );

    if ( !m_doc->presentationName().isEmpty() )
    {
        m_customSlide->setChecked( true );
        m_customSlideCombobox->setCurrentText( m_doc->presentationName() );
    }
    else
        m_selectedSlide->setChecked( true );

    if ( m_customSlideCombobox->count()==0 )
    {
        m_customSlide->setEnabled( false );
        m_labelCustomSlide->setEnabled( false );
        m_customSlideCombobox->setEnabled( false );
    }
    radioButtonClicked();
}
Exemple #29
0
FilterDialog::FilterDialog (QWidget * parent) : QDialog (parent)
{
  // set application icon
  setIcon (QPixmap(":/bitmaps/big.qucs.xpm"));
  setCaption("Qucs Filter " PACKAGE_VERSION);

  all = new QVBoxLayout(this);

  // --------  create menubar  -------------------
  QPopupMenu *fileMenu = new QPopupMenu();
  fileMenu->insertItem(tr("E&xit"), this, SLOT(slotQuit()), Qt::CTRL+Qt::Key_Q);

  QPopupMenu *helpMenu = new QPopupMenu();
  helpMenu->insertItem(
                tr("&About Qucs Filter..."), this, SLOT(slotHelpAbout()), 0);
  helpMenu->insertItem(tr("About Qt..."), this, SLOT(slotHelpAboutQt()), 0);

  QMenuBar *bar = new QMenuBar(this);
  bar->insertItem(tr("&File"), fileMenu);
  bar->insertSeparator ();
  bar->insertItem(tr("&Help"), helpMenu);
  all->addWidget(bar);

  // reserve space for menubar
  all->addSpacing (bar->height() + 2);

  QTabWidget *t = new QTabWidget(this);
  all->addWidget(t);

  // ...........................................................
  QWidget *Tab1 = new QWidget(t);
  QGridLayout *gp1 = new QGridLayout(Tab1,12,6,5,5);

  FilterName = new QComboBox(false, Tab1);
  gp1->addWidget(FilterName,0,0);
  TformName = new QComboBox(false, Tab1);
  gp1->addWidget(TformName,0,1);

  OrderBox = new QCheckBox(tr("Specify order"), Tab1);
  gp1->addWidget(OrderBox,1,0);
  QHBox *h1 = new QHBox(Tab1);
  h1->setSpacing (5);
  OrderCombo = new QComboBox(false, h1);
  OrderCombo->setEnabled(true);
  SubOrderCombo = new QComboBox(false, h1);
  SubOrderCombo->setEnabled(false);
  SubOrderCombo->insertItem( tr( "b" ) );
  SubOrderCombo->insertItem( tr( "c" ) );
  gp1->addWidget(h1,1,1);

  CutoffLabel = new QLabel(tr("Cutoff/Center"),Tab1);
  gp1->addWidget(CutoffLabel,2,0);
  EnterCutoff = new QLineEdit(Tab1);
  gp1->addWidget(EnterCutoff,2,1);
  CutoffCombo = new QComboBox(Tab1);
  CutoffCombo->insertItem( tr( "Hz" ) );
  CutoffCombo->insertItem( tr( "kHz" ) );
  CutoffCombo->insertItem( tr( "MHz" ) );
  CutoffCombo->insertItem( tr( "GHz" ) );
  gp1->addWidget(CutoffCombo,2,2);

  RippleLabel = new QLabel(tr("Ripple"),Tab1);
  gp1->addWidget(RippleLabel,3,0);
  EnterRipple = new QLineEdit(Tab1);
  gp1->addWidget(EnterRipple,3,1);
  RippleUnitLabel = new QLabel(tr("dB"),Tab1);
  gp1->addWidget(RippleUnitLabel,3,2);

  AngleLabel = new QLabel(tr("Angle"),Tab1);
  gp1->addWidget(AngleLabel,3,3);
  EnterAngle = new QLineEdit(Tab1);
  gp1->addWidget(EnterAngle,3,4);
  AngleUnitLabel = new QLabel(tr("°"),Tab1);
  gp1->addWidget(AngleUnitLabel,3,5);

  ZinLabel = new QLabel(tr("Zin"),Tab1);
  gp1->addWidget(ZinLabel,7,0);
  EnterZin = new QLineEdit(Tab1);
  gp1->addWidget(EnterZin,7,1);
  OhmLabel = new QLabel(tr("Ohm"),Tab1);
  gp1->addWidget(OhmLabel,7,2);

  ZoutLabel = new QLabel(tr("Zout"),Tab1);
  ZoutLabel->setEnabled(false);
  gp1->addWidget(ZoutLabel,7,3);
  EnterZout = new QLineEdit(Tab1);
  gp1->addWidget(EnterZout,7,4);
  OhmLabel_2 = new QLabel(tr("Ohm"),Tab1);
  gp1->addWidget(OhmLabel_2,7,5);

  StopbandLabel = new QLabel(tr("Stopband corner"),Tab1);
  gp1->addWidget(StopbandLabel,5,0);
  EnterStopband = new QLineEdit(Tab1);
  gp1->addWidget(EnterStopband,5,1);
  StopbandCombo = new QComboBox(false, Tab1);
  StopbandCombo->insertItem( tr( "Hz" ) );
  StopbandCombo->insertItem( tr( "kHz" ) );
  StopbandCombo->insertItem( tr( "MHz" ) );
  StopbandCombo->insertItem( tr( "GHz" ) );
  gp1->addWidget(StopbandCombo,5,2);

  BandwidthLabel = new QLabel(tr("Bandwidth"),Tab1);
  BandwidthLabel->setEnabled(false);
  gp1->addWidget(BandwidthLabel,4,0);
  EnterBandwidth = new QLineEdit(Tab1);
  gp1->addWidget(EnterBandwidth,4,1);
  BandwidthCombo = new QComboBox(false, Tab1);
  BandwidthCombo->setEnabled(false);
  BandwidthCombo->insertItem( tr( "Hz" ) );
  BandwidthCombo->insertItem( tr( "kHz" ) );
  BandwidthCombo->insertItem( tr( "MHz" ) );
  BandwidthCombo->insertItem( tr( "GHz" ) );
  gp1->addWidget(BandwidthCombo,4,2);

  AttenuationLabel = new QLabel(tr("Attenuation"),Tab1);
  gp1->addWidget(AttenuationLabel,6,0);
  EnterAttenuation = new QLineEdit(Tab1);
  gp1->addWidget(EnterAttenuation,6,1);
  dBLabel = new QLabel(tr("dB"),Tab1);
  gp1->addWidget(dBLabel,6,2);

  DualBox = new QCheckBox(tr("dual"),Tab1);
  gp1->addMultiCellWidget(DualBox,8,8,0,2);
  CauerPoleBox = new QCheckBox(tr("Stopband is first pole"),Tab1);
  CauerPoleBox->setEnabled(false);
  gp1->addMultiCellWidget(CauerPoleBox,9,9,0,2);
  OptimizeCauerBox = new QCheckBox(tr("Optimize cauer"),Tab1);
  OptimizeCauerBox->setEnabled(false);
  gp1->addMultiCellWidget(OptimizeCauerBox,10,10,0,2);
  EqualInductorBox = new QCheckBox(tr("Equal inductors"),Tab1);
  EqualInductorBox->setEnabled(false);
  gp1->addMultiCellWidget(EqualInductorBox,8,8,3,5);
  UseCrossBox = new QCheckBox(tr("+ rather than T"),Tab1);
  UseCrossBox->setEnabled(false);
  gp1->addMultiCellWidget(UseCrossBox,9,9,3,5);

  Cboxes = new QVButtonGroup(tr("Optimize C"),Tab1);
  Cmin = new QRadioButton(tr("Cmin"),Cboxes);
  Cmax = new QRadioButton(tr("Cmax"),Cboxes);
  NoC = new QRadioButton(tr("noC"),Cboxes);
  gp1->addMultiCellWidget(Cboxes,11,11,0,2);

  Lboxes = new QVButtonGroup(tr("Optimize L"),Tab1);
  Lmin = new QRadioButton(tr("Lmin"),Lboxes);
  Lmax = new QRadioButton(tr("Lmax"),Lboxes);
  NoL = new QRadioButton(tr("noL"),Lboxes);
  gp1->addMultiCellWidget(Lboxes,11,11,3,5);

  t->addTab(Tab1, tr("LC Filters"));

  // ...........................................................
  QWidget *Tab2 = new QWidget(t);
  t->addTab(Tab2, tr("Microstrip Filters"));

  // ...........................................................
  QWidget *Tab3 = new QWidget(t);
  t->addTab(Tab3, tr("Active Filters"));

  // reserve space for vertical resizing
  all->addStretch();

  // ...........................................................
  // buttons on the bottom of the dialog (independent of the TabWidget)
  QHBox *Butts = new QHBox(this);
  Butts->setSpacing(3);
  Butts->setMargin(3);
  all->addWidget(Butts);

  cancelButton = new QPushButton(tr("Exit"),Butts);
  okButton = new QPushButton(tr("Calculate"),Butts);
  okButton->setEnabled(false);

  // signals and slots connections
  connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
  connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
}
Exemple #30
0
/**
  This is a generic class for importing line-oriented data from text files. It
  provides a dialog for file selection, preview, separator selection and column
  assignment as well as generic conversion routines. For conversion to special
  data objects, this class has to be inherited by a special class, which
  reimplements the convertRow() function.
*/
KImportDialog::KImportDialog(QWidget *parent)
    : KDialogBase(parent, "importdialog", true, i18n("Import Text File"), Ok | Cancel),
      mSeparator(","),
      mCurrentRow(0)
{
    mData.setAutoDelete(true);

    QVBox *topBox = new QVBox(this);
    setMainWidget(topBox);
    topBox->setSpacing(spacingHint());

    QHBox *fileBox = new QHBox(topBox);
    fileBox->setSpacing(spacingHint());
    new QLabel(i18n("File to import:"), fileBox);
    KURLRequester *urlRequester = new KURLRequester(fileBox);
    urlRequester->setFilter("*.csv");
    connect(urlRequester, SIGNAL(returnPressed(const QString &)),
            SLOT(setFile(const QString &)));
    connect(urlRequester, SIGNAL(urlSelected(const QString &)),
            SLOT(setFile(const QString &)));
    connect(urlRequester->lineEdit(), SIGNAL(textChanged(const QString &)),
            SLOT(slotUrlChanged(const QString &)));
    mTable = new QTable(5, 5, topBox);
    mTable->setMinimumHeight(150);
    connect(mTable, SIGNAL(selectionChanged()), SLOT(tableSelected()));

    QHBox *separatorBox = new QHBox(topBox);
    separatorBox->setSpacing(spacingHint());

    new QLabel(i18n("Separator:"), separatorBox);

    mSeparatorCombo = new KComboBox(separatorBox);
    mSeparatorCombo->insertItem(",");
    mSeparatorCombo->insertItem(i18n("Tab"));
    mSeparatorCombo->insertItem(i18n("Space"));
    mSeparatorCombo->insertItem("=");
    mSeparatorCombo->insertItem(";");
    connect(mSeparatorCombo, SIGNAL(activated(int)),
            this, SLOT(separatorClicked(int)));
    mSeparatorCombo->setCurrentItem(0);

    QHBox *rowsBox = new QHBox(topBox);
    rowsBox->setSpacing(spacingHint());

    new QLabel(i18n("Import starts at row:"), rowsBox);
    mStartRow = new QSpinBox(rowsBox);
    mStartRow->setMinValue(1);
    /*
      new QLabel( i18n( "And ends at row:" ), rowsBox );
      mEndRow = new QSpinBox( rowsBox );
      mEndRow->setMinValue( 1 );
    */
    QVBox *assignBox = new QVBox(topBox);
    assignBox->setSpacing(spacingHint());

    QHBox *listsBox = new QHBox(assignBox);
    listsBox->setSpacing(spacingHint());

    mHeaderList = new QListView(listsBox);
    mHeaderList->addColumn(i18n("Header"));
    connect(mHeaderList, SIGNAL(selectionChanged(QListViewItem *)),
            this, SLOT(headerSelected(QListViewItem *)));
    connect(mHeaderList, SIGNAL(doubleClicked(QListViewItem *)),
            SLOT(assignColumn(QListViewItem *)));

    mFormatCombo = new KComboBox(listsBox);
    mFormatCombo->setDuplicatesEnabled(false);

    QPushButton *assignButton = new QPushButton(i18n("Assign to Selected Column"),
            assignBox);
    connect(assignButton, SIGNAL(clicked()), SLOT(assignColumn()));

    QPushButton *removeButton = new QPushButton(i18n("Remove Assignment From Selected Column"),
            assignBox);
    connect(removeButton, SIGNAL(clicked()), SLOT(removeColumn()));

    QPushButton *assignTemplateButton = new QPushButton(i18n("Assign with Template..."),
            assignBox);
    connect(assignTemplateButton, SIGNAL(clicked()), SLOT(assignTemplate()));

    QPushButton *saveTemplateButton = new QPushButton(i18n("Save Current Template"),
            assignBox);
    connect(saveTemplateButton, SIGNAL(clicked()), SLOT(saveTemplate()));

    resize(500, 300);

    connect(this, SIGNAL(okClicked()), SLOT(applyConverter()));
    connect(this, SIGNAL(applyClicked()), SLOT(applyConverter()));
    enableButtonOK(!urlRequester->lineEdit()->text().isEmpty());
}