Esempio n. 1
0
//---------------------------------------------------------------------------
//
// Constructor
//
AmorDialog::AmorDialog()
    : KDialogBase(0, "amordlg", false, i18n("Options"), Ok|Apply|Cancel, Ok )
{
    mConfig.read();
    QVBox *mainwidget = makeVBoxMainWidget();

    QHBox *hb = new QHBox(mainwidget);

    // Theme list
    QVBox *themeBox = new QVBox(hb);
    themeBox->setSpacing(spacingHint());

    QLabel *label = new QLabel(i18n("Theme:"), themeBox);

    mThemeListBox = new QListBox(themeBox);
    connect(mThemeListBox,SIGNAL(highlighted(int)),SLOT(slotHighlighted(int)));
    mThemeListBox->setMinimumSize( fontMetrics().maxWidth()*20,
				   fontMetrics().lineSpacing()*6 );

    mAboutEdit = new QMultiLineEdit(themeBox);
    mAboutEdit->setReadOnly(true);
    mAboutEdit->setMinimumHeight( fontMetrics().lineSpacing()*4 );

    themeBox->setStretchFactor(mThemeListBox, 4);
    themeBox->setStretchFactor(mAboutEdit, 1);

    // Animation offset
    QVBox *offsetBox = new QVBox(hb);
    offsetBox->setSpacing(spacingHint());
    label = new QLabel(i18n("Offset:"), offsetBox);

    QSlider *slider = new QSlider(-40, 40, 5, mConfig.mOffset,
                                    QSlider::Vertical, offsetBox);
    connect(slider, SIGNAL(valueChanged(int)), SLOT(slotOffset(int)));

    // Always on top
    QCheckBox *checkBox = new QCheckBox(i18n("Always on top"), mainwidget);
    connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotOnTop(bool)));
    checkBox->setChecked(mConfig.mOnTop);

    checkBox = new QCheckBox(i18n("Show random tips"), mainwidget);
    connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotRandomTips(bool)));
    checkBox->setChecked(mConfig.mTips); // always keep this one after the connect, or the QList would not be grayed when it should

    checkBox = new QCheckBox(i18n("Use a random character"), mainwidget);
    connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotRandomTheme(bool)));
    checkBox->setChecked(mConfig.mRandomTheme);

    checkBox = new QCheckBox(i18n("Allow application tips"), mainwidget);
    connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotApplicationTips(bool)));
    checkBox->setChecked(mConfig.mAppTips);

    readThemes();
}
Esempio n. 2
0
QWidget *KasTaskItem::createTaskProps( QObject *target, QWidget *parent, bool recursive )
{
    QVBox *vb = new QVBox( parent );
    vb->setSpacing( KDialog::spacingHint() );
    vb->setMargin( KDialog::marginHint() );

    // Create List View
    KListView *taskprops = new KListView( vb, "props_view" );
    taskprops->setResizeMode( QListView::LastColumn );
    taskprops->addColumn( i18n("Property"), 0 );
    taskprops->addColumn( i18n("Type"), 0 );
    taskprops->addColumn( i18n("Value") );

    // Create List Items
    QMetaObject *mo = target->metaObject();
    for ( int i = 0; i < mo->numProperties( recursive ); i++ ) {
	const QMetaProperty *p = mo->property(i, recursive);

	(void) new KListViewItem( taskprops,
				  p->name(), p->type(),
				  target->property( p->name() ).toString() );
    }

    return vb;
}
Esempio n. 3
0
MediumPluginManagerDialog::MediumPluginManagerDialog()
        : KDialogBase( amaroK::mainWindow(), "mediumpluginmanagerdialog", false, QString::null, Ok|Cancel, Ok )
{
    kapp->setTopWidget( this );
    setCaption( kapp->makeStdCaption( i18n( "Manage Devices and Plugins" ) ) );

    QVBox* vbox = makeVBoxMainWidget();
    vbox->setSpacing( KDialog::spacingHint() );
    vbox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );

    m_location = new QGroupBox( 1, Qt::Vertical, i18n( "Devices" ), vbox );
    m_location->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ) );
    m_devicesBox = new QVBox( m_location );
    m_devicesBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );

    m_manager = new MediumPluginManager( m_devicesBox );

    QHBox *hbox = new QHBox( vbox );
    KPushButton *detectDevices = new KPushButton( i18n( "Autodetect Devices" ), hbox);
    detectDevices->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
    connect( detectDevices, SIGNAL( clicked() ), m_manager, SLOT( redetectDevices() ) );

    KPushButton *addButton = new KPushButton( i18n( "Add Device..." ), hbox );
    addButton->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
    connect( addButton, SIGNAL( clicked() ), m_manager, SLOT( newDevice() ) );
}
Esempio n. 4
0
KServiceSelectDlg::KServiceSelectDlg(const QString & /*serviceType*/, const QString & /*value*/, QWidget *parent)
    : KDialogBase(parent, "serviceSelectDlg", true, i18n("Add Service"), Ok | Cancel, Ok)
{
    QVBox *vbox = new QVBox(this);

    vbox->setSpacing(KDialog::spacingHint());
    new QLabel(i18n("Select service:"), vbox);
    m_listbox = new KListBox(vbox);

    // Can't make a KTrader query since we don't have a servicetype to give,
    // we want all services that are not applications.......
    // So we have to do it the slow way
    // ### Why can't we query for KParts/ReadOnlyPart as the servicetype? Should work fine!
    KService::List allServices = KService::allServices();
    QValueListIterator< KService::Ptr > it(allServices.begin());
    for(; it != allServices.end(); ++it)
        if((*it)->hasServiceType("KParts/ReadOnlyPart"))
        {
            m_listbox->insertItem(new KServiceListItem((*it), KServiceListWidget::SERVICELIST_SERVICES));
        }

    m_listbox->sort();
    m_listbox->setMinimumHeight(350);
    m_listbox->setMinimumWidth(300);
    connect(m_listbox, SIGNAL(doubleClicked(QListBoxItem *)), SLOT(slotOk()));
    setMainWidget(vbox);
}
Esempio n. 5
0
void ProgressDialog::setupGui(const QString& heading)
{
    QVBox* vbox = makeVBoxMainWidget();
    vbox->setSpacing(10);

    QWidget* headingBox = new QWidget(vbox);
    QHBoxLayout* hboxLayout = new QHBoxLayout(headingBox);

    QLabel* textLabel = new QLabel(heading, headingBox);
    textLabel->setMinimumWidth(textLabel->sizeHint().width());
    textLabel->setFixedHeight(textLabel->sizeHint().height());
    hboxLayout->addWidget(textLabel);
    hboxLayout->addStretch();

    d->gear = new KAnimWidget(QString("kde"), 32, headingBox);
    d->gear->setFixedSize(32, 32);
    hboxLayout->addWidget(d->gear);

    d->resultbox = new QListBox(vbox);
    d->resultbox->setSelectionMode(QListBox::NoSelection);
    QFontMetrics fm(d->resultbox->fontMetrics());
    d->resultbox->setMinimumSize(fm.width("0")*70, fm.lineSpacing()*8);

    resize(sizeHint());
}
Esempio n. 6
0
OptionsDialog::OptionsDialog(QWidget *parent)
    : QDialog(parent, 0, false, Qt::WDestructiveClose)
{
    setCaption("QucsTranscalc "+tr("Options"));

    // --------  create dialog widgets  ------------
    vLayout = new QVBoxLayout(this);
    vLayout->setMargin(3);
    vLayout->setSpacing(3);

    QHGroupBox * h = new QHGroupBox(tr("Units"), this);
    vLayout->addWidget(h);
    QVBox * l = new QVBox(h);
    l->setSpacing(3);
    QLabel * lfr = new QLabel(tr("Frequency"),l);
    lfr->setAlignment (Qt::AlignRight);
    QLabel * lle = new QLabel(tr("Length"),l);
    lle->setAlignment (Qt::AlignRight);
    QLabel * lre = new QLabel(tr("Resistance"),l);
    lre->setAlignment (Qt::AlignRight);
    QLabel * lan = new QLabel(tr("Angle"),l);
    lan->setAlignment (Qt::AlignRight);
    QVBox * r = new QVBox(h);
    r->setSpacing(3);
    for (int j = 0; j < 4; j++) {
        units[j] = new QComboBox(r);
        for (int i = 0; TransUnits[j].units[i] != NULL; i++)
            units[j]->insertItem (TransUnits[j].units[i]);
    }
    units[0]->setCurrentItem (QucsSettings.freq_unit);
    units[1]->setCurrentItem (QucsSettings.length_unit);
    units[2]->setCurrentItem (QucsSettings.res_unit);
    units[3]->setCurrentItem (QucsSettings.ang_unit);

    QHBox * h2 = new QHBox(this);
    vLayout->addWidget(h2);

    QPushButton *ButtonSave = new QPushButton(tr("Save as Default"), h2);
    connect(ButtonSave, SIGNAL(clicked()), SLOT(slotSave()));

    QPushButton *ButtonClose = new QPushButton(tr("Dismiss"), h2);
    connect(ButtonClose, SIGNAL(clicked()), SLOT(slotClose()));
    ButtonClose->setFocus();
}
Esempio n. 7
0
ConfigDlg::ConfigDlg(QWidget *parent, const char *name)
 : KDialogBase(KDialogBase::TreeList, WStyle_DialogBorder, parent, name, true, "Settings", KDialogBase::Ok|KDialogBase::Cancel)
{
  setShowIconsInTreeList(true);
  setMinimumSize(600,400);

  enableButtonSeparator(true);
  unfoldTreeList();
  
  QVBox *frame;

  QStringList path;

  path << i18n("Languages");
  setFolderIcon(path, BarIcon("protoeditor", KIcon::SizeSmall));

  QValueList<LanguageSettings*> llist = Protoeditor::self()->settings()->languageSettingsList();
  QValueList<LanguageSettings*>::iterator it;
  for(it = llist.begin(); it != llist.end(); ++it)
  {
    path.clear();
    path << i18n("Languages") << (*it)->languageName();
    frame = addVBoxPage(path, (*it)->languageName(), BarIcon((*it)->iconName(), KIcon::SizeSmall));
    frame->setSpacing(0);
    frame->setMargin(0);
    m_langSettingsWidgets.append((*it)->createSettingsWidget(frame));
  }

  path.clear();
  path << i18n("Sites");
  frame= addVBoxPage(path, i18n("Sites"), BarIcon("package_network", KIcon::SizeSmall));
  frame->setSpacing(0);
  frame->setMargin(0);
  m_siteSettingsWidget = new SiteSettingsWidget(frame);//->reparent(((QWidget*)frame), 0, QPoint());

  path.clear();
  path << i18n("External Applications");
  frame = addVBoxPage(path, i18n("External Applications"), BarIcon("gear", KIcon::SizeSmall));
  frame->setSpacing(0);
  frame->setMargin(0);
  m_extAppSettingsWidget = new ExtAppSettingsWidget(frame, i18n("External Applications"));//->reparent(((QWidget*)frame), 0, QPoint());

  resize(QSize(590, 300).expandedTo(minimumSizeHint()));
}
Esempio n. 8
0
KReferDialog::KReferDialog( KPhoneView * phv,int kcwn,QString uPrefix,QWidget *parent, const char *name )
	: QDialog( parent, name, true )
{
	phoneView=phv;
	kcwNumber= kcwn;
	userPrefix=uPrefix;
	
	phoneBook = 0;
	
	QVBox *vbox = new QVBox( this );
	vbox->setMargin( 3 );
	vbox->setSpacing( 3 );
	QVBoxLayout *vboxl = new QVBoxLayout( this, 5 );
	vboxl->addWidget( vbox );

	(void) new QLabel( tr("Refer-to URI:"), vbox );
	touri = new QLineEdit( vbox );
	touri->setMinimumWidth( fontMetrics().maxWidth() * 20 );
	
	
	QHBoxLayout *buttonBox;
	buttonBox = new QHBoxLayout( vboxl, 6 );
	
	loadUri = new QPushButton( "", this );	
	QIconSet icon;
	icon.setPixmap(SHARE_DIR "/icons/phonebook.png", QIconSet::Automatic );
	loadUri->setIconSet( icon );
	loadUri->setFixedWidth( loadUri->fontMetrics().maxWidth() * 2 );
	buttonBox->addWidget( loadUri );
	
	helpPushButton = new QPushButton( this, tr("help button") );
	helpPushButton->setText( tr("&help...") );
	helpPushButton->setEnabled( FALSE );
	buttonBox->addWidget( helpPushButton );
	
	QSpacerItem *spacer = new QSpacerItem(
		0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
	buttonBox->addItem( spacer );
	okPushButton = new QPushButton( this, tr("ok button") );
	okPushButton->setText( "OK" );
	okPushButton->setDefault( TRUE );
	buttonBox->addWidget( okPushButton );
	
	cancelPushButton = new QPushButton( this,tr( "cancel button") );
	cancelPushButton->setText( tr("Cancel") );
	cancelPushButton->setAccel( Key_Escape );
	buttonBox->addWidget( cancelPushButton );
	
	connect( loadUri, SIGNAL( clicked() ), 
		this, SLOT( getUri() ) );
	connect( okPushButton, SIGNAL( clicked() ),
		this, SLOT( slotOk() ) );
	connect( cancelPushButton, SIGNAL( clicked() ),
		this, SLOT( slotCancel() ) );
}
Esempio n. 9
0
NotesControl::NotesControl( QWidget *, const char * )
        : QVBox( 0, "NotesControl",/* WDestructiveClose | */WStyle_StaysOnTop )
//        : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup )
{
    Config cfg("Notes");
    cfg.setGroup("Options");
    m_showMax = cfg.readBoolEntry("ShowMax", false);

    setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
    m_loaded = false;
    m_edited = false;
    QVBox *vbox = new QVBox( this, "Vlayout" );
    QHBox  *hbox = new QHBox( this, "HLayout" );

    m_editArea = new QMultiLineEdit( vbox, "OpieNotesView" );

    m_notesList = new QListBox( vbox, "OpieNotesBox" );

    QPEApplication::setStylusOperation( m_notesList->viewport(), QPEApplication::RightOnHold );

    m_notesList->setFixedHeight( 50 );

    vbox->setMargin( 6 );
    vbox->setSpacing( 3 );


    setFocusPolicy(QWidget::StrongFocus);

    newButton = new QPushButton( hbox, "newButton" );
    newButton->setText(tr("New"));

    saveButton = new QPushButton( hbox, "saveButton" );
    saveButton->setText(tr("Save"));

    deleteButton = new QPushButton( hbox, "deleteButton" );
    deleteButton->setText(tr("Delete"));


    connect( m_notesList, SIGNAL( mouseButtonPressed(int,QListBoxItem*,const QPoint&)),
             this,SLOT( boxPressed(int,QListBoxItem*,const QPoint&)) );

    connect( m_notesList, SIGNAL(highlighted(const QString&)), this, SLOT(slotBoxSelected(const QString&)));

    connect( &menuTimer, SIGNAL( timeout() ), SLOT( showMenu() ) );

    connect( m_editArea,SIGNAL( textChanged() ), this, SLOT(slotViewEdited() ) );

    connect( newButton, SIGNAL(clicked()), this, SLOT(slotNewButton()) );
    connect( saveButton, SIGNAL(clicked()), this, SLOT(slotSaveButton()) );
    connect( deleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteButton()) );

    m_selected = -1;
    setCaption("Notes");
}
Esempio n. 10
0
void MainWindow::initWidgets()
{
  // includes sidebar and part stack
  mTopWidget = new QHBox( this );
  mTopWidget->setFrameStyle( QFrame::Panel | QFrame::Sunken );
  setCentralWidget( mTopWidget );

  QHBox *mBox = 0;
  mSplitter = new QSplitter( mTopWidget );
  mBox = new QHBox( mTopWidget );
  mSidePane = new IconSidePane( this, mSplitter );
  mSidePane->setSizePolicy( QSizePolicy( QSizePolicy::Maximum,
                                         QSizePolicy::Preferred ) );
  // donÄt occupy screen estate on load
  QValueList<int> sizes;
  sizes << 0;
  mSplitter->setSizes(sizes);

  mSidePane->setActionCollection( actionCollection() );

  connect( mSidePane, SIGNAL( pluginSelected( Kontact::Plugin * ) ),
           SLOT( selectPlugin( Kontact::Plugin * ) ) );

  QVBox *vBox;
  if ( mSplitter ) {
    vBox = new QVBox( mSplitter );
  } else {
    vBox = new QVBox( mBox );
  }

  vBox->setSpacing( 0 );

  mPartsStack = new QWidgetStack( vBox );
  initAboutScreen();

  QString loading = i18n( "<h2 style='text-align:center; margin-top: 0px; margin-bottom: 0px'>%1</h2>" )
                    .arg( i18n("Loading Kontact...") );

  paintAboutScreen( loading );

  /* Create a progress dialog and hide it. */
  KPIM::ProgressDialog *progressDialog = new KPIM::ProgressDialog( statusBar(), this );
  progressDialog->hide();

  mLittleProgress = new KPIM::StatusbarProgressWidget( progressDialog, statusBar() );

  mStatusMsgLabel = new KRSqueezedTextLabel( i18n( " Initializing..." ), statusBar() );
  mStatusMsgLabel->setAlignment( AlignLeft | AlignVCenter );

  statusBar()->addWidget( mStatusMsgLabel, 10 , false );
  statusBar()->addWidget( mLittleProgress, 0 , true );
  mLittleProgress->show();
}
QWidget * DataRecorderChannelBoolean::getPropertyWidget(QWidget * parent, const char * name)
{
	if (!m_propertyWidget)
	{
		// Setup widget
		QVBox * widget = new QVBox(parent,name);
		Q_CHECK_PTR(widget);
		widget->setMargin(KDialog::marginHint());
		widget->setSpacing(KDialog::spacingHint());
		
		QLabel * lab;
		lab = new QLabel(i18n("DataRecorder", "Channel:"), widget);
		Q_CHECK_PTR(lab);
		
		KSimLineEdit * conName;
		conName = new KSimLineEdit(widget);
		Q_CHECK_PTR(conName);
		conName->setText(getConnector()->getName());
		connect(getConnector(), SIGNAL(signalSetName(const QString &)), conName, SLOT(setText(const QString &)));
		connect(conName, SIGNAL(changed(const QString &)), SLOT(setChannelName(const QString &)));
		lab->setBuddy(conName);
		// TODO add ToolTip

		
		ChannelPositionWidget * pos;
		pos = new ChannelPositionWidget(this, widget);
		Q_CHECK_PTR(pos);
		pos->setGainValue(getVerticalGain());
		pos->setOffsetValue(getVerticalOffset());
		connect(pos, SIGNAL(gainChanged(double)), SLOT(setVerticalGain(double)));
		connect(pos, SIGNAL(offsetChanged(double)), SLOT(setVerticalOffset(double)));
		
		
		KColorButton * color = new KColorButton(widget);
		Q_CHECK_PTR(color);
		color->setColor(getLineColor());
		connect(color, SIGNAL(changed(const QColor &)), SLOT(setLineColor(const QColor &)));
		
		
		m_propertyWidget = widget;
	}
	else
	{
		if (parent)
		{
			KSIMDEBUG("Only one widget allowed");
		}
	}
		
	return m_propertyWidget;	
}
Esempio n. 12
0
Kfind::Kfind(QWidget *parent, const char *name) : QWidget(parent, name)
{
    kdDebug() << "Kfind::Kfind " << this << endl;
    QBoxLayout *mTopLayout = new QBoxLayout(this, QBoxLayout::LeftToRight, KDialog::marginHint(), KDialog::spacingHint());

    // create tabwidget
    tabWidget = new KfindTabWidget(this);
    mTopLayout->addWidget(tabWidget);

    /*
     * This is ugly.  Might be a KSeparator bug, but it makes a small black
     * pixel for me which is visually distracting (GS).
    // create separator
    KSeparator * mActionSep = new KSeparator( this );
    mActionSep->setFocusPolicy( QWidget::ClickFocus );
    mActionSep->setOrientation( QFrame::VLine );
    mTopLayout->addWidget(mActionSep);
    */

    // create button box
    QVBox *mButtonBox = new QVBox(this);
    QVBoxLayout *lay = (QVBoxLayout *)mButtonBox->layout();
    lay->addStretch(1);
    mTopLayout->addWidget(mButtonBox);

    mSearch = new KPushButton(KGuiItem(i18n("&Find"), "find"), mButtonBox);
    mButtonBox->setSpacing((tabWidget->sizeHint().height() - 4 * mSearch->sizeHint().height()) / 4);
    connect(mSearch, SIGNAL(clicked()), this, SLOT(startSearch()));
    mStop = new KPushButton(KGuiItem(i18n("Stop"), "stop"), mButtonBox);
    connect(mStop, SIGNAL(clicked()), this, SLOT(stopSearch()));
    mSave = new KPushButton(KStdGuiItem::saveAs(), mButtonBox);
    connect(mSave, SIGNAL(clicked()), this, SLOT(saveResults()));

    KPushButton *mClose = new KPushButton(KStdGuiItem::close(), mButtonBox);
    connect(mClose, SIGNAL(clicked()), this, SIGNAL(destroyMe()));

    // react to search requests from widget
    connect(tabWidget, SIGNAL(startSearch()), this, SLOT(startSearch()));

    mSearch->setEnabled(true); // Enable "Search"
    mStop->setEnabled(false);  // Disable "Stop"
    mSave->setEnabled(false);  // Disable "Save..."

    dirlister = new KDirLister();
}
Esempio n. 13
0
/**
 * @short Shows a popup
 * @author Rene Schmidt <*****@*****.**>
 * @version 0.1
 */
void KLAidWidget::showPopUp(QString &caption, QString &text, uint &tOut)
{
  // Tell user when the next popup will be shown
  QToolTip::add(tray, i18n("K Learning Aid %1").arg(VER) + "\nNext PopUp will be shown at " + aut->projectTime(aut->getInterval()));

 // this is a candidate for subclassing... Copied in part from kpassivepopup.cpp (c) by KDE Team
    KPassivePopup *pop = new KPassivePopup( tray );

    pop->setPaletteForegroundColor(*tmpFgColor);
    pop->setPaletteBackgroundColor(*tmpBgColor);
    
    QVBox *vb = new QVBox( pop );
    vb->setSpacing( KDialog::spacingHint() );
 
      QHBox *hb=0;
      hb = new QHBox(vb);
      hb->setMargin(0);
      hb->setSpacing(KDialog::spacingHint() );
      QLabel *ttlIcon=0;
      ttlIcon = new QLabel( hb, "title_icon" );
      ttlIcon->setPixmap( SmallIcon("ktimer") );
      ttlIcon->setAlignment( AlignLeft );

      if ( !caption.isEmpty() ) {
        QLabel *ttl=0;
        ttl = new QLabel(caption, hb ? hb : vb, "title_label");
  
        ttl->setFont( *fntCaption );
        ttl->setAlignment( Qt::AlignHCenter );
            if ( hb )
                hb->setStretchFactor( ttl, 10 ); // enforce centering
      }
  
      if ( !text.isEmpty() ) {
        QLabel *msg=0;
        msg = new QLabel( text, vb, "msg_label" );
        msg->setFont( *fntBody );
        msg->setAlignment( AlignLeft );
      }

    pop->setTimeout(tOut);
    //pop->setView( title, txt, SmallIcon("ktimer"));
    pop->setView(vb);
    pop->show();
}
Esempio n. 14
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();
}
Esempio n. 15
0
void KonviConfigDialog::addPageInternal(QWidget *page,
                                        const QStringList &items,
                                        const QString &pixmapName,
                                        const QString &header)
{
    if(d->shown)
    {
        kdDebug(240) << "KonviConfigDialog::addPage: can not add a page after the dialog has been shown.";
        return;
    }
    switch(d->type)
    {
        case TreeList:
        case IconList:
        case Tabbed:
        {
            QVBox *frame = addVBoxPage(items, header, SmallIcon(pixmapName, 16));
            frame->setSpacing( 0 );
            frame->setMargin( 0 );
            page->reparent(((QWidget*)frame), 0, QPoint());
            m_lastAddedIndex = pageIndex(frame);
        }
        break;

        case Swallow:
        {
            page->reparent(this, 0, QPoint());
            setMainWidget(page);
        }
        break;

        case Plain:
        {
            QFrame *main = plainPage();
            QVBoxLayout *topLayout = new QVBoxLayout( main, 0, 0 );
            page->reparent(((QWidget*)main), 0, QPoint());
            topLayout->addWidget( page );
        }
        break;

        default:
            kdDebug(240) << "KonviConfigDialog::addpage: unknown type.";
    }
}
Esempio n. 16
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();
}
Esempio n. 17
0
void KBabelView::showTryLaterMessageBox()
{
    if( !_showTryLaterBox ) return;

    KDialogBase *dialog= new KDialogBase(
		i18n("Information"),
		KDialogBase::Yes,
		KDialogBase::Yes, KDialogBase::Yes,
		this, "information", true, true,
		KStdGuiItem::ok() );

    QVBox *topcontents = new QVBox (dialog);
    topcontents->setSpacing(KDialog::spacingHint()*2);
    topcontents->setMargin(KDialog::marginHint()*2);

    QWidget *contents = new QWidget(topcontents);
    QHBoxLayout * lay = new QHBoxLayout(contents);
    lay->setSpacing(KDialog::spacingHint()*2);

    lay->addStretch(1);
    QLabel *label1 = new QLabel( contents);
    label1->setPixmap(QMessageBox::standardIcon(QMessageBox::Information));
    lay->add( label1 );
    QLabel *label2 = new QLabel( i18n("The search string has not been found yet.\n"
	         "However, the string might be found "
		 "in the files being searched at the moment.\n"
		 "Please try later."), contents);
    label2->setAlignment( Qt::AlignAuto | Qt::AlignVCenter | Qt::ExpandTabs | Qt::WordBreak );
    label2->setMinimumSize(label2->sizeHint());
    lay->add( label2 );
    lay->addStretch(1);

    QCheckBox *checkbox = new QCheckBox(i18n("Do not show in this find/replace session again"), topcontents);

    dialog->setMainWidget(topcontents);
    dialog->enableButtonSeparator(false);
    dialog->incInitialSize( QSize(50,0) );

    dialog->exec();

    _showTryLaterBox = !checkbox->isChecked();
    delete dialog;
}
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();
}
Esempio n. 19
0
FileBrowser::FileBrowser( const char * name, Medium * medium )
        : QVBox( 0, name )
{
    KActionCollection *actionCollection;
    SearchPane *searchPane;

    KURL *location;

    // Try to keep filebrowser working even if not in a medium context
    // so if a medium object not passed in, keep earlier behavior
    if (!medium) {
        m_medium = 0;
        location = new KURL( Pana::config( "Filebrowser" )->readPathEntry( "Location", QDir::homeDirPath() ) );
        KFileItem *currentFolder = new KFileItem( KFileItem::Unknown, KFileItem::Unknown, *location );
        //KIO sucks, NetAccess::exists puts up a dialog and has annoying error message boxes
        //if there is a problem so there is no point in using it anyways.
        //so... setting the diroperator to ~ is the least sucky option
        if ( !location->isLocalFile() || !currentFolder->isReadable() ) {
            delete location;
            location = new KURL( QDir::homeDirPath() ) ;
        }
    }
    else{
        m_medium = medium;
        location = new KURL( m_medium->mountPoint() );
    }

    KActionCollection* ac = new KActionCollection( this );
    KStdAction::selectAll( this, SLOT( selectAll() ), ac, "filebrowser_select_all" );

    KToolBar *toolbar = new Browser::ToolBar( this );

    { //Filter LineEdit
        KToolBar* searchToolBar = new Browser::ToolBar( this );
        KToolBarButton *button = new KToolBarButton( "locationbar_erase", 0, searchToolBar );
        m_filter = new ClickLineEdit( i18n( "Enter search terms here" ), searchToolBar );

        searchToolBar->setStretchableWidget( m_filter );

        connect( button, SIGNAL(clicked()), m_filter, SLOT(clear()) );

        QToolTip::add( button, i18n( "Clear search field" ) );
        QToolTip::add( m_filter, i18n( "Enter space-separated terms to search in the directory-listing" ) );
    }

    { //Directory Listing
        QVBox *container; QHBox *box;

        container = new QVBox( this );
        container->setFrameStyle( m_filter->frameStyle() );
        container->setMargin( 3 );
        container->setSpacing( 2 );
        container->setBackgroundMode( Qt::PaletteBase );

        box = new QHBox( container );
        box->setMargin( 3 );
        box->setBackgroundMode( Qt::PaletteBase );

        //folder selection combo box
        m_combo = new KURLComboBox( KURLComboBox::Directories, true, box, "path combo" );

        if (!m_medium){
            m_combo->setCompletionObject( new KURLCompletion( KURLCompletion::DirCompletion ) );
            m_combo->setAutoDeleteCompletionObject( true );
        }
        m_combo->setMaxItems( 9 );
        m_combo->setURLs( Pana::config( "Filebrowser" )->readPathListEntry( "Dir History" ) );

        if (!m_medium)
            m_combo->lineEdit()->setText( location->path() );
        else
            m_combo->lineEdit()->setText( "/" );

        //The main widget with file listings and that
        m_dir = new MyDirOperator( *location, container, m_medium );
        m_dir->setEnableDirHighlighting( true );
        m_dir->setMode( KFile::Mode((int)KFile::Files | (int)KFile::Directory) ); //allow selection of multiple files + dirs
        m_dir->setOnlyDoubleClickSelectsFiles( true ); //Pana type settings
        m_dir->readConfig( Pana::config( "Filebrowser" ) );
        m_dir->setView( KFile::Default ); //will set userconfigured view, will load URL
        m_dir->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding );
        m_dir->setAcceptDrops( true );
        //Automatically open folder after hovering above it...probably a good thing
        //but easily disabled by commenting this line out
        //Disabled for now because can't show . and .. folders.
        //TODO: Find out a way to fix this?
        //m_dir->setDropOptions( KFileView::AutoOpenDirs );

        static_cast<QFrame*>(m_dir->viewWidget())->setFrameStyle( QFrame::NoFrame );
        static_cast<QIconView*>(m_dir->viewWidget())->setSpacing( 1 );

        actionCollection = m_dir->actionCollection();

        searchPane = new SearchPane( this );

        setStretchFactor( container, 2 );
    }

    {
        QPopupMenu* const menu = static_cast<KActionMenu*>(actionCollection->action("popupMenu"))->popupMenu();

        menu->clear();
        menu->insertItem( SmallIconSet( Pana::icon( "files" ) ), i18n( "&Load" ), MakePlaylist );
        menu->insertItem( SmallIconSet( Pana::icon( "add_playlist" ) ), i18n( "&Append to Playlist" ), AppendToPlaylist );
        menu->insertItem( SmallIconSet( Pana::icon( "queue_track" ) ), i18n( "&Queue Track" ), QueueTrack );
        menu->insertItem( SmallIconSet( Pana::icon( "queue_track" ) ), i18n( "&Queue Tracks" ), QueueTracks );

        menu->insertItem( SmallIconSet( Pana::icon( "save" ) ), i18n( "&Save as Playlist..." ), SavePlaylist );
        menu->insertSeparator();

        if (!m_medium)
            menu->insertItem( SmallIconSet( Pana::icon( "device" ) ), i18n( "&Transfer to Media Device" ), MediaDevice );

        menu->insertItem( SmallIconSet( Pana::icon( "collection" ) ), i18n( "&Organize Files..." ), OrganizeFiles );
        menu->insertItem( SmallIconSet( Pana::icon( "collection" ) ), i18n( "&Copy Files to Collection..." ), CopyToCollection );
        menu->insertItem( SmallIconSet( Pana::icon( "collection" ) ), i18n( "&Move Files to Collection..." ), MoveToCollection );
        menu->insertItem( SmallIconSet( Pana::icon( "burn" ) ), i18n("Burn to CD..."), BurnCd );
        menu->insertSeparator();
        menu->insertItem( i18n( "&Select All Files" ), SelectAllFiles );
        menu->insertSeparator();
        actionCollection->action( "delete" )->setIcon( Pana::icon( "remove" ) );
        actionCollection->action( "delete" )->plug( menu );
        menu->insertSeparator();
        menu->insertItem( SmallIconSet( Pana::icon( "info" ) ), i18n( "Edit Track &Information..." ), EditTags );
        actionCollection->action( "properties" )->plug( menu );

        menu->setItemEnabled( BurnCd, K3bExporter::isAvailable() );

        connect( menu, SIGNAL(aboutToShow()), SLOT(prepareContextMenu()) );
        connect( menu, SIGNAL(activated( int )), SLOT(contextMenuActivated( int )) );
    }

    {
        KActionMenu *a;

        a = static_cast<KActionMenu*>( actionCollection->action( "sorting menu" ) );
        a->setIcon( Pana::icon( "configure" ) );
        a->setDelayed( false ); //TODO should be done by KDirOperator

        actionCollection->action( "delete" )->setShortcut( KShortcut( SHIFT + Key_Delete ) );

        a = new KActionMenu( i18n("Bookmarks"), "bookmark", actionCollection, "bookmarks" );
        a->setDelayed( false );

        new KBookmarkHandler( m_dir, a->popupMenu() );
    }

    {
        if ( KAction *a = actionCollection->action( "up" ) )
            a->plug( toolbar );
        if ( KAction *a = actionCollection->action( "back" ) )
            a->plug( toolbar );
        if ( KAction *a = actionCollection->action( "forward" ) )
            a->plug( toolbar );
        if ( KAction *a = actionCollection->action( "home" ) )
            a->plug( toolbar );
        if ( KAction *a = actionCollection->action( "reload" ) ) {
            a->setIcon( Pana::icon( "refresh" ) );
            a->plug( toolbar );
        }

        toolbar->insertLineSeparator();

        if ( KAction *a = actionCollection->action( "short view" ) )
            a->plug( toolbar );
        if ( KAction *a = actionCollection->action( "detailed view" ) )
            a->plug( toolbar );

        toolbar->insertLineSeparator();

        if ( KAction *a = actionCollection->action( "sorting menu" ) )
            a->plug( toolbar );
        if ( KAction *a = actionCollection->action( "bookmarks" ) )
            a->plug( toolbar );


        KAction *gotoCurrent = new KAction( i18n("Go To Current Track Folder"), Pana::icon( "music" ), 0,
                                            this, SLOT( gotoCurrentFolder() ), actionCollection );
        gotoCurrent->plug( toolbar );

        disconnect( actionCollection->action( "up" ), SIGNAL( activated() ), m_dir, SLOT( cdUp() ) );
        connect( actionCollection->action( "up" ), SIGNAL( activated() ), m_dir, SLOT( myCdUp() ) );
        disconnect( actionCollection->action( "home" ), SIGNAL( activated() ), m_dir, SLOT( home() ) );
        connect( actionCollection->action( "home" ), SIGNAL( activated() ), m_dir, SLOT( myHome() ) );
    }

    connect( m_filter, SIGNAL(textChanged( const QString& )), SLOT(setFilter( const QString& )) );
    connect( m_combo, SIGNAL(urlActivated( const KURL& )), SLOT(setUrl( const KURL& )) );
    connect( m_combo, SIGNAL(returnPressed( const QString& )), SLOT(setUrl( const QString& )) );
    connect( m_dir, SIGNAL(viewChanged( KFileView* )), SLOT(slotViewChanged( KFileView* )) );
    connect( m_dir, SIGNAL(fileSelected( const KFileItem* )), SLOT(activate( const KFileItem* )) );
    connect( m_dir, SIGNAL(urlEntered( const KURL& )), SLOT(urlChanged( const KURL& )) );
    connect( m_dir, SIGNAL(urlEntered( const KURL& )), searchPane, SLOT(urlChanged( const KURL& )) );
    connect( m_dir, SIGNAL(dropped( const KFileItem*, QDropEvent*, const KURL::List& )),
                        SLOT(dropped( const KFileItem*, QDropEvent*, const KURL::List& )) );

    setSpacing( 4 );
    setFocusProxy( m_dir ); //so the dirOperator is focused when we get focus events
    // Toolbar is more than 250px wide, BrowserBar doesn't allow that. -> Resizing issues.
    setMinimumWidth( 250 /* toolbar->sizeHint().width() */ );
}
Esempio n. 20
0
QWidget* MyFracWindow::createDisplayDock(QWidget* parent)
{
	QVBox* wrapper = new QVBox(parent);
	wrapper->setSpacing(0);

	QGrid* propDisplay = new QGrid(2, wrapper);
	propDisplay->setMargin(7);
	propDisplay->setSpacing(5);

	new QLabel(i18n("Color gradient:"), propDisplay);
	GradientButton* gradButton = new GradientButton(propDisplay);
	connect(this, SIGNAL(gradientChanged(const QRgb*, double, double)), gradButton, SLOT(setGradient(const QRgb*, double, double)));
	connect(gradButton, SIGNAL(clicked()), this, SLOT(onGradientEdit()));
	QToolTip::add(gradButton, i18n("Gradient used to display the fractal"));

	new QLabel(i18n("Color scale:"), propDisplay);
	_sliderScale = new QSlider(QSlider::Horizontal, propDisplay);
	_sliderScale->setRange(0, 100);
	connect(_sliderScale, SIGNAL(valueChanged(int)), SLOT(setGradientScale(int)));
	QToolTip::add(_sliderScale, i18n("Scale of the color gradient"));

	new QLabel(i18n("Color offset:"), propDisplay);
	_sliderOffset = new QSlider(QSlider::Horizontal, propDisplay);
	_sliderOffset->setRange(0, 100);
	connect(_sliderOffset, SIGNAL(valueChanged(int)), SLOT(setGradientOffset(int)));
	QToolTip::add(_sliderOffset, i18n("Offset of the color gradient"));

	new QLabel(i18n("Scroll colors:"), propDisplay);
	QHBox* box = new QHBox(propDisplay);
	box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
	box->setSpacing(5);
	QComboBox* combo = new QComboBox(box);
	combo->insertItem(i18n("scroll direction", "Off"));
	combo->insertItem(i18n("scroll direction", "Left"));
	combo->insertItem(i18n("scroll direction", "Right"));
	connect(combo, SIGNAL(activated(int)), SLOT(setScrollMode(int)));
	_sliderScroll = new QSlider(QSlider::Horizontal, box);
	_sliderScroll->setRange(0, 100);
	_sliderScroll->setEnabled(false);
	connect(_sliderScroll, SIGNAL(valueChanged(int)), SLOT(setScrollSpeed(int)));
	QToolTip::add(combo, i18n("Scrolling direction"));
	QToolTip::add(_sliderScroll, i18n("Scrolling speed"));

	new QLabel(i18n("Background:"), propDisplay);
	_colorButton = new KColorButton(_backgroundColor, propDisplay);
	connect(_colorButton, SIGNAL(changed(const QColor&)), SLOT(selectBackground(const QColor&)));
	QToolTip::add(_colorButton, i18n("Color of the background area"));

	new QLabel(i18n("3D grid size:"), propDisplay);
	_comboGrid = new QComboBox(propDisplay);
	for (int i = 64; i <= 1024; i *= 2)
		_comboGrid->insertItem(i18n("%1 x %2").arg(i).arg(i));
	_comboGrid->setEnabled(false);
	connect(_comboGrid, SIGNAL(activated(int)), SLOT(setGridSize(int)));
	QToolTip::add(_comboGrid, i18n("Resolution of the 3D mesh"));

	new QLabel(i18n("Height scale:"), propDisplay);
	_sliderHeight = new QSlider(QSlider::Horizontal, propDisplay);
	_sliderHeight->setRange(0, 100);
	_sliderHeight->setEnabled(false);
	connect(_sliderHeight, SIGNAL(valueChanged(int)), SLOT(setHeightScale(int)));
	QToolTip::add(_sliderHeight, i18n("Height scale of the 3D mesh"));

	wrapper->setStretchFactor(new QWidget(wrapper), 1);

	return wrapper;
}
Esempio n. 21
0
DeviceConfigureDialog::DeviceConfigureDialog( const Medium &medium )
        : KDialogBase( amaroK::mainWindow(), "deviceconfiguredialog", true, QString("Select Plugin for " + medium.name()), Ok|Cancel, Ok, false )
{
    m_medium = new Medium( medium );
    kapp->setTopWidget( this );
    setCaption( kapp->makeStdCaption( i18n( "Configure Media Device" ) ) );
    showButtonApply( false );

    QVBox* vbox = makeVBoxMainWidget();
    vbox->setSpacing( KDialog::spacingHint() );

    QLabel *connectLabel = 0;
    m_connectEdit = 0;
    QLabel *disconnectLabel = 0;
    m_disconnectEdit = 0;
    m_transcodeCheck = 0;
    QButtonGroup *transcodeGroup = 0;
    m_transcodeAlways = 0;
    m_transcodeWhenNecessary = 0;
    m_transcodeRemove = 0;

    MediaDevice* device = MediaBrowser::instance()->deviceFromId( m_medium->id() );

    if( device )
    {
        device->loadConfig();

        // pre-connect/post-disconnect (mount/umount)
        connectLabel = new QLabel( vbox );
        connectLabel->setText( i18n( "Pre-&connect command:" ) );
        m_connectEdit = new HintLineEdit( device->m_preconnectcmd, vbox );
        m_connectEdit->setHint( i18n( "Example: mount %d" ) );
        connectLabel->setBuddy( m_connectEdit );
        QToolTip::add( m_connectEdit, i18n( "Set a command to be run before connecting to your device (e.g. a mount command) here.\n%d is replaced by the device node, %m by the mount point.\nEmpty commands are not executed." ) );

        disconnectLabel = new QLabel( vbox );
        disconnectLabel->setText( i18n( "Post-&disconnect command:" ) );
        m_disconnectEdit = new HintLineEdit( device->m_postdisconnectcmd, vbox );
        disconnectLabel->setBuddy( m_disconnectEdit );
        m_disconnectEdit->setHint( i18n( "Example: eject %d" ) );
        QToolTip::add( m_disconnectEdit, i18n( "Set a command to be run after disconnecting from your device (e.g. an eject command) here.\n%d is replaced by the device node, %m by the mount point.\nEmpty commands are not executed." ) );

        // transcode
        m_transcodeCheck = new QCheckBox( vbox );
        m_transcodeCheck->setText( i18n( "&Transcode before transferring to device" ) );
        m_transcodeCheck->setChecked( device->m_transcode );

        transcodeGroup = new QVButtonGroup( vbox );
        transcodeGroup->setTitle( i18n( "Transcode to preferred format for device" ) );
        m_transcodeAlways = new QRadioButton( transcodeGroup );
        m_transcodeAlways->setText( i18n( "Whenever possible" ) );
        m_transcodeAlways->setChecked( device->m_transcodeAlways );
        m_transcodeWhenNecessary = new QRadioButton( transcodeGroup );
        m_transcodeWhenNecessary->setText( i18n( "When necessary" ) );
        m_transcodeWhenNecessary->setChecked( !device->m_transcodeAlways );
        connect( m_transcodeCheck, SIGNAL(toggled( bool )),
                transcodeGroup, SLOT(setEnabled( bool )) );
        transcodeGroup->insert( m_transcodeAlways );
        transcodeGroup->insert( m_transcodeWhenNecessary );
        m_transcodeRemove = new QCheckBox( transcodeGroup );
        m_transcodeRemove->setText( i18n( "Remove transcoded files after transfer" ) );
        m_transcodeRemove->setChecked( device->m_transcodeRemove );

        const ScriptManager *sm = ScriptManager::instance();
        m_transcodeCheck->setEnabled( sm->transcodeScriptRunning() != QString::null );
        transcodeGroup->setEnabled( sm->transcodeScriptRunning() != QString::null && device->m_transcode );
        if( sm->transcodeScriptRunning().isNull() )
        {
            QToolTip::add( m_transcodeCheck, i18n( "For this feature, a script of type \"Transcode\" has to be running" ) );
            QToolTip::add( transcodeGroup, i18n( "For this feature, a script of type \"Transcode\" has to be running" ) );
        }

        device->addConfigElements( vbox );
    }

    m_accepted = false;
}
Esempio n. 22
0
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 );
}
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);
}
Esempio n. 24
0
CoverManager::CoverManager()
        : QSplitter( 0, "TheCoverManager" )
        , m_timer( new QTimer( this ) )    //search filter timer
        , m_fetchCounter( 0 )
        , m_fetchingCovers( 0 )
        , m_coversFetched( 0 )
        , m_coverErrors( 0 )
{
    DEBUG_BLOCK

    s_instance = this;

    // Sets caption and icon correctly (needed e.g. for GNOME)
    kapp->setTopWidget( this );
    setCaption( kapp->makeStdCaption( i18n("Cover Manager") ) );
    setWFlags( WDestructiveClose );
    setMargin( 4 );

    //artist listview
    m_artistView = new KListView( this );
    m_artistView->addColumn(i18n( "Albums By" ));
    m_artistView->setFullWidth( true );
    m_artistView->setSorting( -1 );    //no sort
    m_artistView->setMinimumWidth( 180 );
    KListViewItem *item = new KListViewItem( m_artistView, i18n( "All Albums" ) );
    item->setPixmap( 0, SmallIcon("cdrom_unmount") );

    //load artists from the collection db
    const QStringList artists = CollectionDB::instance()->artistList( false, false );
    foreach( artists )  {
        item = new KListViewItem( m_artistView, item, *it );
        item->setPixmap( 0, SmallIcon("personal") );
    }
    QueryBuilder qb;
    qb.addReturnValue( QueryBuilder::tabAlbum, QueryBuilder::valName );
    qb.setOptions( QueryBuilder::optOnlyCompilations | QueryBuilder::optRemoveDuplicates );
    qb.setLimit( 0, 1 );
    if ( qb.run().count() ) {
        item = new KListViewItem( m_artistView, item, i18n( "Various Artists" ) );
        item->setPixmap( 0, SmallIcon("personal") );
    }

    QVBox *vbox = new QVBox( this );
    QHBox *hbox = new QHBox( vbox );

    vbox->setSpacing( 4 );
    hbox->setSpacing( 4 );

    { //<Search LineEdit>
        QHBox *searchBox = new QHBox( hbox );
        KToolBar* searchToolBar = new Browser::ToolBar( searchBox );
        KToolBarButton *button = new KToolBarButton( "locationbar_erase", 0, searchToolBar );
        m_searchEdit = new ClickLineEdit( i18n( "Filter here..." ), searchToolBar );
        m_searchEdit->setFrame( QFrame::Sunken );

        searchToolBar->setStretchableWidget( m_searchEdit );
        connect( button, SIGNAL(clicked()), m_searchEdit, SLOT(clear()) );

        QToolTip::add( button, i18n( "Clear filter" ) );
        QToolTip::add( m_searchEdit, i18n( "Enter space-separated terms to filter albums" ) );

        hbox->setStretchFactor( searchBox, 1 );
    } //</Search LineEdit>

    // view menu
    m_viewMenu = new KPopupMenu( this );
    m_viewMenu->insertItem( i18n("All Albums"), AllAlbums );
    m_viewMenu->insertItem( i18n("Albums With Cover"), AlbumsWithCover );
    m_viewMenu->insertItem( i18n("Albums Without Cover"), AlbumsWithoutCover );
    m_viewMenu->setItemChecked( AllAlbums, true );
    connect( m_viewMenu, SIGNAL( activated(int) ), SLOT( changeView(int) ) );

    #ifdef AMAZON_SUPPORT
    // amazon locale menu
    m_amazonLocaleMenu = new KPopupMenu( this );
    m_amazonLocaleMenu->insertItem( i18n("International"), International );
    m_amazonLocaleMenu->insertItem( i18n("Canada"), Canada );
    m_amazonLocaleMenu->insertItem( i18n("France"), France );
    m_amazonLocaleMenu->insertItem( i18n("Germany"), Germany );
    m_amazonLocaleMenu->insertItem( i18n("Japan"), Japan);
    m_amazonLocaleMenu->insertItem( i18n("United Kingdom"), UK );
    connect( m_amazonLocaleMenu, SIGNAL( activated(int) ), SLOT( changeLocale(int) ) );
    #endif

    KToolBar* toolBar = new KToolBar( hbox );
    toolBar->setIconText( KToolBar::IconTextRight );
    toolBar->setFrameShape( QFrame::NoFrame );
    toolBar->insertButton( "view_choose", 1, m_viewMenu, true, i18n( "View" ) );
    #ifdef AMAZON_SUPPORT
    const QString babelfish = locate( "data", QString( "amarok/images/babelfish.png" ) );
    toolBar->insertButton( babelfish, 2, m_amazonLocaleMenu, true, i18n( "Amazon Locale" ) );

    QString locale = AmarokConfig::amazonLocale();

         if( locale == "fr" ) m_currentLocale = France;
    else if( locale == "de" ) m_currentLocale = Germany;
    else if( locale == "jp" ) m_currentLocale = Japan;
    else if( locale == "uk" ) m_currentLocale = UK;
    else if( locale == "ca" ) m_currentLocale = Canada;
    else {
        // make sure we handle old config files correctly
        locale = "us";
        m_currentLocale = International;
    }

    m_amazonLocaleMenu->setItemChecked( m_currentLocale, true );

    //fetch missing covers button
    m_fetchButton = new KPushButton( KGuiItem( i18n("Fetch Missing Covers"), "cdrom_unmount" ), hbox );
    connect( m_fetchButton, SIGNAL(clicked()), SLOT(fetchMissingCovers()) );
    #endif

    //cover view
    m_coverView = new CoverView( vbox );

    //status bar
    KStatusBar *m_statusBar = new KStatusBar( vbox );
    m_statusBar->addWidget( m_statusLabel = new KSqueezedTextLabel( m_statusBar ), 4 );
    m_statusLabel->setIndent( 3 );
    m_statusBar->addWidget( m_progressBox = new QHBox( m_statusBar ), 1, true );
    KPushButton *stopButton = new KPushButton( KGuiItem(i18n("Abort"), "stop"), m_progressBox );
    connect( stopButton, SIGNAL(clicked()), SLOT(stopFetching()) );
    m_progress = new KProgress( m_progressBox );
    m_progress->setCenterIndicator( true );

    const int h = m_statusLabel->height() + 3;
    m_statusLabel->setFixedHeight( h );
    m_progressBox->setFixedHeight( h );
    m_progressBox->hide();


    // signals and slots connections
    connect( m_artistView, SIGNAL(selectionChanged( QListViewItem* ) ),
                           SLOT(slotArtistSelected( QListViewItem* )) );
    connect( m_coverView,  SIGNAL(rightButtonPressed( QIconViewItem*, const QPoint& )),
                           SLOT(showCoverMenu( QIconViewItem*, const QPoint& )) );
    connect( m_coverView,  SIGNAL(executed( QIconViewItem* )),
                           SLOT(coverItemExecuted( QIconViewItem* )) );
    connect( m_timer,      SIGNAL(timeout()),
                           SLOT(slotSetFilter()) );
    connect( m_searchEdit, SIGNAL(textChanged( const QString& )),
                           SLOT(slotSetFilterTimeout()) );

    #ifdef AMAZON_SUPPORT
    connect( CollectionDB::instance(), SIGNAL(coverFetched( const QString&, const QString& )),
                                       SLOT(coverFetched( const QString&, const QString& )) );
    connect( CollectionDB::instance(), SIGNAL(coverRemoved( const QString&, const QString& )),
                                       SLOT(coverRemoved( const QString&, const QString& )) );
    connect( CollectionDB::instance(), SIGNAL(coverFetcherError( const QString& )),
                                       SLOT(coverFetcherError()) );
    #endif

    m_currentView = AllAlbums;

    QSize size = QApplication::desktop()->screenGeometry( this ).size() / 1.5;
    resize( amaroK::config( "Cover Manager" )->readSizeEntry( "Window Size", &size ) );

    show();

    QTimer::singleShot( 0, this, SLOT(init()) );
}
Esempio n. 25
0
TransferDialog::TransferDialog( MediaDevice *mdev )
        : KDialogBase( Pana::mainWindow(), "transferdialog", true, QString::null, Ok|Cancel, Ok )
{
    m_dev = mdev;
    m_accepted = false;
    m_sort1LastIndex = m_sort2LastIndex = -1;

    kapp->setTopWidget( this );
    setCaption( kapp->makeStdCaption( i18n( "Transfer Queue to Device" ) ) );

    QVBox* vbox = makeVBoxMainWidget();
    vbox->setSpacing( KDialog::spacingHint() );

    QString transferDir = mdev->getTransferDir();

    QGroupBox *location = new QGroupBox( 1, Qt::Vertical, i18n( "Music Location" ), vbox );

    new QLabel( i18n( "Your music will be transferred to:\n%1" )
                    .arg( transferDir ), location );

    QVBox *vbox2 = new QVBox( vbox );
    QSpacerItem *spacer = new QSpacerItem( 0, 25 );
    QLayout *vlayout = vbox2->layout();
    if( vlayout )
        vlayout->addItem( spacer );

    new QLabel( i18n( "You can have your music automatically grouped in\n"
                      "a variety of ways. Each grouping will create\n"
                      "directories based upon the specified criteria.\n"), vbox );

    QGroupBox *sorting = new QGroupBox( 6, Qt::Vertical, i18n( "Groupings" ), vbox );
    m_label1 = new QLabel( i18n( "Select first grouping:\n" ), sorting );
    m_sort1  = new KComboBox( sorting );
    m_label2 = new QLabel( i18n( "Select second grouping:\n" ), sorting );
    m_sort2  = new KComboBox( sorting );
    m_label3 = new QLabel( i18n( "Select third grouping:\n" ), sorting );
    m_sort3  = new KComboBox( sorting );

    m_combolist = new QPtrList<KComboBox>();
    m_combolist->append( m_sort1 );
    m_combolist->append( m_sort2 );
    m_combolist->append( m_sort3 );

    KComboBox * comboTemp;
    for( comboTemp = m_combolist->first(); comboTemp; comboTemp = m_combolist->next() )
    {
        comboTemp->insertItem( i18n("None") );
        comboTemp->insertItem( i18n("Artist") );
        comboTemp->insertItem( i18n("Album") );
        comboTemp->insertItem( i18n("Genre") );
        comboTemp->setCurrentItem( 0 );
    }

    m_sort1->setCurrentItem( mdev->m_firstSort );
    m_sort2->setCurrentItem( mdev->m_secondSort );
    m_sort3->setCurrentItem( mdev->m_thirdSort );

    m_label2->setDisabled( m_sort1->currentItem() == 0 );
    m_sort2->setDisabled( m_sort1->currentItem() == 0 );
    m_label3->setDisabled( m_sort2->currentItem() == 0 );
    m_sort3->setDisabled( m_sort2->currentItem() == 0 );

    connect( m_sort1, SIGNAL( activated(int) ), SLOT( sort1_activated(int)) );
    connect( m_sort2, SIGNAL( activated(int) ), SLOT( sort2_activated(int)) );

    QVBox *vbox3 = new QVBox( vbox );
    QSpacerItem *spacer2 = new QSpacerItem( 0, 25 );
    QLayout *vlayout2 = vbox3->layout();
    if( vlayout2 )
        vlayout2->addItem( spacer2 );

    QGroupBox *options = new QGroupBox( 6, Qt::Vertical, i18n( "Options" ), vbox );

    QCheckBox *convertSpaces = new QCheckBox( i18n( "Convert spaces to underscores" ), options );
    convertSpaces->setChecked( mdev->getSpacesToUnderscores() );

    connect( convertSpaces, SIGNAL( toggled(bool) ), this, SLOT( convertSpaces_toggled(bool) ) );
}
Esempio n. 26
0
KURLBarItemDialog::KURLBarItemDialog(bool allowGlobal, const KURL &url, const QString &description, QString icon, bool appLocal, int iconSize,
                                     QWidget *parent, const char *name)
    : KDialogBase(parent, name, true, i18n("Edit Quick Access Entry"), Ok | Cancel, Ok, true)
{
    QVBox *box = new QVBox(this);
    QString text = i18n("<qt><b>Please provide a description, URL and icon for this Quick Access entry.</b></br></qt>");
    QLabel *label = new QLabel(text, box);
    box->setSpacing(spacingHint());

    QGrid *grid = new QGrid(2, box);
    grid->setSpacing(spacingHint());

    QString whatsThisText = i18n(
        "<qt>This is the text that will appear in the Quick Access panel.<p>"
        "The description should consist of one or two words "
        "that will help you remember what this entry refers to.</qt>");
    label = new QLabel(i18n("&Description:"), grid);
    m_edit = new KLineEdit(grid, "description edit");
    m_edit->setText(description.isEmpty() ? url.fileName() : description);
    label->setBuddy(m_edit);
    QWhatsThis::add(label, whatsThisText);
    QWhatsThis::add(m_edit, whatsThisText);

    whatsThisText = i18n(
                        "<qt>This is the location associated with the entry. Any valid URL may be used. For example:<p>"
                        "%1<br>http://www.kde.org<br>ftp://ftp.kde.org/pub/kde/stable<p>"
                        "By clicking on the button next to the text edit box you can browse to an "
                        "appropriate URL.</qt>")
                        .arg(QDir::homeDirPath());
    label = new QLabel(i18n("&URL:"), grid);
    m_urlEdit = new KURLRequester(url.prettyURL(), grid);
    m_urlEdit->setMode(KFile::Directory);
    label->setBuddy(m_urlEdit);
    QWhatsThis::add(label, whatsThisText);
    QWhatsThis::add(m_urlEdit, whatsThisText);

    whatsThisText = i18n(
        "<qt>This is the icon that will appear in the Quick Access panel.<p>"
        "Click on the button to select a different icon.</qt>");
    label = new QLabel(i18n("Choose an &icon:"), grid);
    m_iconButton = new KIconButton(grid, "icon button");
    m_iconButton->setIconSize(iconSize);
    if(icon.isEmpty())
        icon = KMimeType::iconForURL(url);
    m_iconButton->setIcon(icon);
    label->setBuddy(m_iconButton);
    QWhatsThis::add(label, whatsThisText);
    QWhatsThis::add(m_iconButton, whatsThisText);

    if(allowGlobal)
    {
        QString appName;
        if(KGlobal::instance()->aboutData())
            appName = KGlobal::instance()->aboutData()->programName();
        if(appName.isEmpty())
            appName = QString::fromLatin1(KGlobal::instance()->instanceName());
        m_appLocal = new QCheckBox(i18n("&Only show when using this application (%1)").arg(appName), box);
        m_appLocal->setChecked(appLocal);
        QWhatsThis::add(m_appLocal, i18n("<qt>Select this setting if you want this "
                                         "entry to show only when using the current application (%1).<p>"
                                         "If this setting is not selected, the entry will be available in all "
                                         "applications.</qt>")
                                        .arg(appName));
    }
    else
        m_appLocal = 0L;
    connect(m_urlEdit->lineEdit(), SIGNAL(textChanged(const QString &)), this, SLOT(urlChanged(const QString &)));
    m_edit->setFocus();
    setMainWidget(box);
}
Esempio n. 27
0
KTreemapPage::KTreemapPage( KSettingsDialog *	dialog,
					    QWidget *		parent,
					    KDirStatApp *	mainWin )
    : KSettingsPage( dialog, parent )
    , _mainWin( mainWin )
{
    // kdDebug() << k_funcinfo << endl;

    QVBoxLayout * layout = new QVBoxLayout( this, 0, 0 ); // parent, border, spacing

    QVBox * vbox	= new QVBox( this );
    vbox->setSpacing( dialog->spacingHint() );
    layout->addWidget( vbox );

    _squarify		= new QCheckBox( i18n( "S&quarify Treemap"	), vbox );
    _doCushionShading	= new QCheckBox( i18n( "Use C&ushion Shading"	), vbox );


    // Cushion parameters

    QVGroupBox * gbox	= new QVGroupBox( i18n( "Cushion Parameters" ), vbox );
    _cushionParams	= gbox;
    gbox->addSpace( 7 );
    gbox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );

    QLabel * label	= new QLabel( i18n( "Ambient &Light" ), gbox );
    QHBox * hbox	= new QHBox( gbox );
    _ambientLight	= new QSlider ( MinAmbientLight, MaxAmbientLight, 10,	// min, max, pageStep
					DefaultAmbientLight, Horizontal, hbox );
    _ambientLightSB	= new QSpinBox( MinAmbientLight, MaxAmbientLight, 1,	// min, max, step
					hbox );
    _ambientLightSB->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
    label->setBuddy( _ambientLightSB );

    gbox->addSpace( 7 );
    label		= new QLabel( i18n( "&Height Scale" ), gbox );
    hbox		= new QHBox( gbox );
    _heightScalePercent = new QSlider( MinHeightScalePercent, MaxHeightScalePercent, 10,   // min, max, pageStep
				       DefaultHeightScalePercent, Horizontal, hbox );
    _heightScalePercentSB = new QSpinBox( MinHeightScalePercent, MaxHeightScalePercent, 1, // min, max, step
					  hbox );
    _heightScalePercentSB->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
    label->setBuddy( _heightScalePercentSB );

    gbox->addSpace( 10 );
    _ensureContrast	= new QCheckBox( i18n( "Draw Lines if Lo&w Contrast"	), gbox );


    hbox		= new QHBox( gbox );
    _forceCushionGrid	= new QCheckBox( i18n( "Always Draw &Grid"		), hbox );
    addHStretch( hbox );

    _cushionGridColorL	= new QLabel( "	   " + i18n( "Gr&id Color: " ), hbox );
    _cushionGridColor	= new KColorButton( hbox );
    _cushionGridColorL->setBuddy( _cushionGridColor );
    _cushionGridColorL->setAlignment( AlignRight | AlignVCenter );

    // addVStretch( vbox );


    // Plain treemaps parameters

    _plainTileParams	= new QHGroupBox( i18n( "Colors for Plain Treemaps" ), vbox );

    _plainTileParams->addSpace( 7 );
    label		= new QLabel( i18n( "&Files: " ), _plainTileParams );
    _fileFillColor	= new KColorButton( _plainTileParams );
    label->setBuddy( _fileFillColor );
    label->setAlignment( AlignRight | AlignVCenter );

    label		= new QLabel( "	   " + i18n( "&Directories: " ), _plainTileParams );
    _dirFillColor	= new KColorButton( _plainTileParams );
    label->setBuddy( _dirFillColor );
    label->setAlignment( AlignRight | AlignVCenter );

    label		= new QLabel( i18n( "Gr&id: " ), _plainTileParams );
    _outlineColor	= new KColorButton( _plainTileParams );
    label->setBuddy( _outlineColor );
    label->setAlignment( AlignRight | AlignVCenter );


    // Misc

    QWidget * gridBox	= new QWidget( vbox );
    QGridLayout * grid	= new QGridLayout( gridBox, 2, 3, dialog->spacingHint() ); // rows, cols, spacing
    grid->setColStretch( 0, 0 ); // (col, stretch) don't stretch this column
    grid->setColStretch( 1, 0 ); // don't stretch
    grid->setColStretch( 2, 1 ); // stretch this as you like

    label		= new QLabel( i18n( "Hi&ghlight R&ectangle: " ), gridBox );
    _highlightColor	= new KColorButton( gridBox );
    label->setBuddy( _highlightColor );

    grid->addWidget( label,		0, 0 );
    grid->addWidget( _highlightColor,	0, 1 );


    label		= new QLabel( i18n( "Minim&um Treemap Tile Size: " ), gridBox );
    _minTileSize	= new QSpinBox( 0, 30, 1, gridBox ); // min, max, step, parent
    label->setBuddy( _minTileSize );

    grid->addWidget( label,		1, 0 );
    grid->addWidget( _minTileSize,	1, 1 );

    _autoResize		= new QCheckBox( i18n( "Auto-&Resize Treemap" ), vbox );



    // Connections

    connect( _ambientLight,		SIGNAL( valueChanged(int) ),
	     _ambientLightSB,		SLOT  ( setValue    (int) ) );

    connect( _ambientLightSB,		SIGNAL( valueChanged(int) ),
	     _ambientLight,		SLOT  ( setValue    (int) ) );


    connect( _heightScalePercent,	SIGNAL( valueChanged(int) ),
	     _heightScalePercentSB,	SLOT  ( setValue    (int) ) );

    connect( _heightScalePercentSB,	SIGNAL( valueChanged(int) ),
	     _heightScalePercent,	SLOT  ( setValue    (int) ) );


    connect( _doCushionShading, SIGNAL( stateChanged( int ) ), this, SLOT( checkEnabledState() ) );
    connect( _forceCushionGrid, SIGNAL( stateChanged( int ) ), this, SLOT( checkEnabledState() ) );

    checkEnabledState();
}
Esempio n. 28
0
QWidget* MyFracWindow::createParamsDock(QWidget* parent)
{
	QVBox* wrapper = new QVBox(parent);
	wrapper->setSpacing(0);

	QGrid* propParams = new QGrid(2, wrapper);
	propParams->setMargin(7);
	propParams->setSpacing(5);

	new QLabel(i18n("X coordinate:"), propParams);
	_editPosX = new QLineEdit(propParams);
	_editPosX->setValidator(new QDoubleValidator(-4.0, 4.0, 15, _editPosX));
	connect(_editPosX, SIGNAL(returnPressed()), SLOT(readPosition()));
	connect(_editPosX, SIGNAL(lostFocus()), SLOT(readPosition()));
	QToolTip::add(_editPosX, i18n("X coordinate of the center of the view"));

	new QLabel(i18n("Y coordinate:"), propParams);
	_editPosY = new QLineEdit(propParams);
	_editPosY->setValidator(new QDoubleValidator(-4.0, 4.0, 15, _editPosY));
	connect(_editPosY, SIGNAL(returnPressed()), SLOT(readPosition()));
	connect(_editPosY, SIGNAL(lostFocus()), SLOT(readPosition()));
	QToolTip::add(_editPosY, i18n("Y coordinate of the center of the view"));

	new QLabel(i18n("Zoom magnitude:"), propParams);
	_editZoom = new QLineEdit(propParams);
	_editZoom->setValidator(new QDoubleValidator(-1.0, 14.0, 15, _editZoom));
	connect(_editZoom, SIGNAL(returnPressed()), SLOT(readPosition()));
	connect(_editZoom, SIGNAL(lostFocus()), SLOT(readPosition()));
	QToolTip::add(_editZoom, i18n("Zoom order of maginitude"));

	new QLabel(i18n("Rotation angle:"), propParams);
	_editAngle = new QLineEdit(propParams);
	_editAngle->setValidator(new QDoubleValidator(-360.0, 360.0, 15, _editAngle));
	connect(_editAngle, SIGNAL(returnPressed()), SLOT(readPosition()));
	connect(_editAngle, SIGNAL(lostFocus()), SLOT(readPosition()));
	QToolTip::add(_editAngle, i18n("View rotation angle in degrees"));

	new QLabel(i18n("Julia X param.:"), propParams);
	_editJuliaX = new QLineEdit(propParams);
	connect(_editJuliaX, SIGNAL(returnPressed()), SLOT(readJulia()));
	connect(_editJuliaX, SIGNAL(lostFocus()), SLOT(readJulia()));
	QToolTip::add(_editJuliaX, i18n("X coordinate of the Julia parameter"));

	new QLabel(i18n("Julia Y param.:"), propParams);
	_editJuliaY = new QLineEdit(propParams);
	connect(_editJuliaY, SIGNAL(returnPressed()), SLOT(readJulia()));
	connect(_editJuliaY, SIGNAL(lostFocus()), SLOT(readJulia()));
	QToolTip::add(_editJuliaY, i18n("Y coordinate of the Julia parameter"));

	new QLabel(i18n("Iterations limit:"), propParams);
	_sliderIterations = new QSlider(QSlider::Horizontal, propParams);
	_sliderIterations->setRange(0, 20);
	connect(_sliderIterations, SIGNAL(valueChanged(int)), SLOT(setMaxIterations(int)));
	QToolTip::add(_sliderIterations, i18n("Maximum number of iterations to calculate"));

	new QLabel(i18n("Detail level:"), propParams);
	_sliderQuality = new QSlider(QSlider::Horizontal, propParams);
	_sliderQuality->setRange(0, 10);
	connect(_sliderQuality, SIGNAL(valueChanged(int)), SLOT(setQuality(int)));
	QToolTip::add(_sliderQuality, i18n("Amount of details to calculate"));

	wrapper->setStretchFactor(new QWidget(wrapper), 1);

	return wrapper;
}
Esempio n. 29
0
layerDialog::layerDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "layerDialog" );
    setSizeGripEnabled( true );

	generalDialog = new QTabWidget( this, "generalDialog" );

	layout = new QWidget( generalDialog, "layout" );

	QButtonGroup *box = new QButtonGroup(2,QGroupBox::Horizontal,QString::null,layout);
	box->setFlat (true);
	box->setLineWidth (0);
	box->setInsideMargin (0);

	QVBox *vbox = new QVBox(box);
	vbox->setMargin(5);
	vbox->setSpacing(5);

	QHBox *hbox1 = new QHBox(vbox);
	hbox1->setSpacing(5);

	new QLabel( tr( "Number of Layers" ), hbox1);
	layersBox = new QSpinBox(0,100,1,hbox1);

	fitBox=new QCheckBox(vbox);
	fitBox->setChecked(FALSE);

	QButtonGroup *groupAlign = new QButtonGroup(2,QGroupBox::Horizontal,tr("Alignement"),box);

    new QLabel( tr("Horizontal" ), groupAlign, 0,0 );
	alignHorBox = new QComboBox( FALSE, groupAlign, 0 );
	alignHorBox->insertItem( tr( "Center" ) );
	alignHorBox->insertItem( tr( "Left" ) );
	alignHorBox->insertItem( tr( "Right" ) );

    new QLabel( tr( "Vertical" ), groupAlign, 0,0 );
	alignVertBox = new QComboBox( FALSE, groupAlign, 0 );
	alignVertBox->insertItem( tr( "Center" ) );
	alignVertBox->insertItem( tr( "Top" ) );
	alignVertBox->insertItem( tr( "Bottom" ) );

	QVBox *vbox2 = new QVBox(box);
	vbox2->setSpacing(5);

	GroupBox1 = new QButtonGroup( 2,QGroupBox::Horizontal,tr("Grid"),vbox2);

    new QLabel( tr( "Columns" ), GroupBox1, "TextLabel1",0 );
	boxX = new QSpinBox(1,100,1,GroupBox1, "boxX" );

    new QLabel( tr( "Rows" ), GroupBox1, "TextLabel2",0 );
	boxY = new QSpinBox(1,100,1,GroupBox1, "boxY" );

	GroupCanvasSize = new QButtonGroup(2,QGroupBox::Horizontal,tr("&Layer Canvas Size"),vbox2);
	GroupCanvasSize->setCheckable(true);
	GroupCanvasSize->setChecked(false);

    new QLabel( tr("Width" ), GroupCanvasSize, "TextLabel1",0 );
	boxCanvasWidth = new QSpinBox(0,10000,50,GroupCanvasSize, "boxCanvasWidth" );
	boxCanvasWidth->setSuffix(tr(" pixels"));

    new QLabel( tr( "Height" ), GroupCanvasSize, "TextLabel2",0 );
	boxCanvasHeight = new QSpinBox(0,10000,50,GroupCanvasSize, "boxCanvasHeight" );
	boxCanvasHeight->setSuffix(tr(" pixels"));

	GroupBox4 = new QButtonGroup( 2,QGroupBox::Horizontal,tr("Spacing"),box);

  	new QLabel( tr( "Columns gap" ), GroupBox4, "TextLabel4",0 );
	boxColsGap = new QSpinBox(0,100,5,GroupBox4, "boxColsGap" );
	boxColsGap->setSuffix(tr(" pixels"));

    new QLabel( tr( "Rows gap" ), GroupBox4, "TextLabel5",0 );
	boxRowsGap = new QSpinBox(0,100,5,GroupBox4, "boxRowsGap" );
	boxRowsGap->setSuffix(tr(" pixels"));

	new QLabel( tr( "Left margin" ), GroupBox4, "TextLabel7",0 );
	boxLeftSpace = new QSpinBox(0,1000,5,GroupBox4, "boxLeftSpace" );
	boxLeftSpace->setSuffix(tr(" pixels"));

	new QLabel( tr( "Right margin" ), GroupBox4, "TextLabel6",0 );
	boxRightSpace = new QSpinBox(0,1000,5,GroupBox4, "boxRightSpace" );
	boxRightSpace->setSuffix(tr(" pixels"));

	new QLabel( tr( "Top margin" ), GroupBox4, "TextLabel8",0 );
	boxTopSpace = new QSpinBox(0,1000,5,GroupBox4, "boxTopSpace" );
	boxTopSpace->setSuffix(tr(" pixels"));

    new QLabel( tr( "Bottom margin" ), GroupBox4, "TextLabel9",0 );
	boxBottomSpace = new QSpinBox(0,1000,5,GroupBox4, "boxBottomSpace" );
	boxBottomSpace->setSuffix(tr(" pixels"));

	QVBoxLayout* hlayout1 = new QVBoxLayout(layout,5,5, "hlayout1");
	hlayout1->addWidget(box);

	generalDialog->insertTab(layout, tr( "Layout" ) );

	fonts = new QWidget( generalDialog, "fonts" );
	GroupBox2 = new QButtonGroup( 1,QGroupBox::Horizontal, QString::null,fonts,"GroupBox2" );

    btnTitle = new QPushButton(GroupBox2, "btnTitle" );
	btnAxisLegend = new QPushButton(GroupBox2, "btnAxisLegend" );
	btnAxisNumbers = new QPushButton(GroupBox2, "btnAxisNumbers" );
	btnLegend = new QPushButton(GroupBox2, "btnLegend" );

	QVBoxLayout* vl2 = new QVBoxLayout(fonts,5,5, "vl2");
	vl2->addWidget(GroupBox2);
 
	generalDialog->insertTab(fonts, tr( "Fonts" ) );

	QHBox *hbox2=new QHBox(this, "hbox2");
	hbox2->setSpacing(5);

	buttonApply = new QPushButton(hbox2, "buttonApply" );

	buttonOk = new QPushButton(hbox2, "buttonOk" );
    buttonOk->setAutoDefault( TRUE );
    buttonOk->setDefault( TRUE );

    buttonCancel = new QPushButton(hbox2, "buttonCancel" );
    buttonCancel->setAutoDefault( TRUE );

	QVBoxLayout* vl = new QVBoxLayout(this,10, 5, "vl");
	vl->addWidget(generalDialog);
    vl->addWidget(hbox2);

    languageChange();

    connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
	connect( buttonApply, SIGNAL( clicked() ), this, SLOT(update() ) );
    connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
	connect( btnTitle, SIGNAL( clicked() ), this, SLOT( setTitlesFont() ) );
	connect( btnAxisLegend, SIGNAL( clicked() ), this, SLOT( setAxisLegendFont() ) );
	connect( btnAxisNumbers, SIGNAL( clicked() ), this, SLOT( setAxisNumbersFont() ) );
    connect( btnLegend, SIGNAL( clicked() ), this, SLOT( setLegendsFont() ) );
	connect( fitBox, SIGNAL( toggled(bool) ), this, SLOT(enableLayoutOptions(bool) ) );
}
Esempio n. 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());
}