예제 #1
0
XineConfig::XineConfig(const xine_t* const xine) :
		KDialogBase(KDialogBase::IconList, i18n("xine Engine Parameters"),
		            KDialogBase::Ok|KDialogBase::Apply|KDialogBase::Cancel, KDialogBase::Cancel)

{
	setInitialSize(QSize(650,500), true);

	m_xine = (xine_t*)xine;

	QStringList cats = getCategories();
	QTabWidget* tabWidget = NULL;
	QFrame* xineFrame = NULL;
	QVBoxLayout* xineLayout = NULL;
	QVBox* xineBeginnerPage = NULL;
	QVBox* xineExpertPage = NULL;
	QString icon;

	QStringList::ConstIterator end ( cats.end());
	for (QStringList::ConstIterator it = cats.begin(); it != end; ++it)
	{
		//  kdDebug() << "XineConfig: add page: " << *it << endl;
		if (*it == "audio")
			icon = "sound";
		else if (*it == "video")
			icon = "video";
		else if (*it == "vcd")
			icon = "cdrom_unmount";
		else if (*it == "input")
			icon = "connect_established";
		else if (*it == "effects")
			icon = "wizard";
		else if (*it == "media")
			icon = "cdrom_unmount";
		else if (*it == "subtitles")
			icon = "font_bitmap";
		else if (*it == "osd")
			icon = "font_bitmap";
		else if (*it == "engine")
			icon = "exec";
		else
			icon = "edit";

		xineFrame = addPage(*it, i18n("%1 Options").arg(*it), KGlobal::iconLoader()->loadIcon(icon, KIcon::Panel,
		                    KIcon::SizeMedium));
		xineLayout = new QVBoxLayout(xineFrame, marginHint(), spacingHint());
		tabWidget = new QTabWidget(xineFrame);
		xineLayout->addWidget(tabWidget);
		xineBeginnerPage = new QVBox(tabWidget);
		xineBeginnerPage->setMargin(5);
		tabWidget->addTab(xineBeginnerPage, i18n("Beginner Options"));
		createPage(*it, false, xineBeginnerPage);
		xineExpertPage = new QVBox(tabWidget);
		xineExpertPage->setMargin(5);
		tabWidget->addTab(xineExpertPage, i18n("Expert Options"));
		createPage(*it, true, xineExpertPage);
	}

	connect(this, SIGNAL(okClicked()), SLOT(slotOkPressed()));
	connect(this, SIGNAL(applyClicked()), SLOT(slotApplyPressed()));
}
예제 #2
0
KHLogin::KHLogin(QWidget *parent ) : KDialogBase(parent, "KHLogin", true, i18n("Log in"), User1 |KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, true)
{
    QVBox *page = makeVBoxMainWidget();
    page->setMargin(5);
    page->setLineWidth(4);
    page->setMidLineWidth(4);
    page->setFrameStyle (QFrame::Box | QFrame::Raised );

    QVGroupBox *m_container = new QVGroupBox(i18n("Select your player"),page);

    m_selector = new KHSelectUser(m_container);
    m_selector->readPlayers(true);
    connect(m_selector, SIGNAL(playerSelected()), this, SLOT(setPlayerInformation()));

    QVBox *m_infoBox = new QVBox(m_container);

    m_labelName = new QLabel(i18n("Name: "), m_container);
    m_labelElo = new QLabel(i18n("Elo: "), m_container);
    m_labelType = new QLabel(i18n("Type: "), m_container);

    new KSeparator(m_container);

    new QLabel(i18n("Login"), m_container);
    m_login = new KLineEdit(m_container);
    new QLabel(i18n("Password"), m_container);
    m_password = new KLineEdit(m_container);

    setModal(true);

    setButtonGuiItem (KDialogBase::User1, KGuiItem( i18n("Create a new user"), SmallIcon("penguin"), i18n("Click to create new user"), i18n("Clicking this button you can create a new user") ));

    hide();
}
예제 #3
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;
}
예제 #4
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()));
}
예제 #5
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() ) );
}
예제 #6
0
파일: notes.cpp 프로젝트: opieproject/opie
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");
}
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;	
}
예제 #8
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.";
    }
}
예제 #9
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;
}
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);
}
예제 #11
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 );
}
예제 #12
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() */ );
}
예제 #13
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) ) );
}
예제 #14
0
FFTDialog::FFTDialog(int type, QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
	setCaption(tr("QtiPlot - FFT Options"));
	
	d_table = 0;
	graph = 0;
	d_type = type;

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

	QButtonGroup *GroupFFT = new QButtonGroup(2,QGroupBox::Horizontal,tr(""), box, "GroupBox3" );
	GroupFFT->setRadioButtonExclusive ( TRUE );
	
    forwardBtn = new QRadioButton(GroupFFT, "forwardBtn" );
	forwardBtn->setChecked( TRUE );

    backwardBtn = new QRadioButton(GroupFFT, "backwardBtn" );

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

	if (d_type == onGraph)
		new QLabel( tr("Curve"), GroupBox1, "TextLabel1",0 );
	else
		new QLabel( tr("Sampling"), GroupBox1, "TextLabel1",0 );

	boxName = new QComboBox(GroupBox1, "boxShow" );
	
	if (d_type == onTable)
		{
		new QLabel( tr("Real"), GroupBox1, "TextLabel11",0 );
		boxReal = new QComboBox(GroupBox1, "boxReal" );

		new QLabel( tr("Imaginary"), GroupBox1, "TextLabel111",0 );
		boxImaginary = new QComboBox(GroupBox1, "Imaginary" );
		}

	new QLabel( tr("Sampling Interval"), GroupBox1, "TextLabel4",0 );
	boxSampling = new QLineEdit(GroupBox1, "boxStart" );
	
	boxNormalize = new QCheckBox(box, "boxNorm" );
	boxNormalize->setChecked(true);

	boxOrder = new QCheckBox(box, "boxOrder" );
	boxOrder->setChecked(true);

	QButtonGroup *GroupBox2 = new QButtonGroup(1,QGroupBox::Horizontal,tr(""),this,"GroupBox2" );
	GroupBox2->setFlat (TRUE);
	GroupBox2->setLineWidth (0);

	buttonOK = new QPushButton(GroupBox2, "buttonFit" );
    buttonOK->setDefault( TRUE );
   
    buttonCancel = new QPushButton(GroupBox2, "buttonCancel" );
	
	QHBoxLayout* hlayout = new QHBoxLayout(this,5,5, "hlayout");
    hlayout->addWidget(box);
	hlayout->addWidget(GroupBox2);

    languageChange();
	setFocusProxy(boxName);
   
    // signals and slots connections
	connect( boxName, SIGNAL( activated(int) ), this, SLOT( activateCurve(int) ) );
	connect( buttonOK, SIGNAL( clicked() ), this, SLOT( accept() ) );
    connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
}