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);
}
Beispiel #2
0
ViewPage::ViewPage( QWidget* parent ) : PageBase( parent )
{
	QWidget*     page;
	QVBoxLayout* layout;
	QGroupBox*   colorGroupBox;
	QHGroupBox*  snolGroupBox;
	QHGroupBox*  tabGroupBox;
	QLabel*      label;

	page   = new QWidget( this );
	layout = new QVBoxLayout( page );
	layout->setSpacing( KDialog::spacingHint() );
	layout->setMargin( KDialog::marginHint() );

	// add a groupbox
	colorGroupBox = new QGroupBox( 2, Qt::Horizontal, i18n( "Colors" ), page );
	layout->addWidget( colorGroupBox );
	colorGroupBox->setMargin( KDialog::marginHint() );

	// add the removeColor
	label = new QLabel( i18n( "Removed color:" ), colorGroupBox );
	m_removedColorButton = new KColorButton( colorGroupBox );
	label->setBuddy( m_removedColorButton );

	// add the changeColor
	label = new QLabel( i18n( "Changed color:" ), colorGroupBox );
	m_changedColorButton = new KColorButton( colorGroupBox );
	label->setBuddy( m_changedColorButton );

	// add the addColor
	label = new QLabel( i18n( "Added color:" ), colorGroupBox );
	m_addedColorButton = new KColorButton( colorGroupBox );
	label->setBuddy( m_addedColorButton );

	// add the appliedColor
	label = new QLabel( i18n( "Applied color:" ), colorGroupBox );
	m_appliedColorButton = new KColorButton( colorGroupBox );
	label->setBuddy( m_appliedColorButton );

	// scroll number of lines (snol)
	snolGroupBox = new QHGroupBox( i18n( "Mouse Wheel" ), page );
	layout->addWidget( snolGroupBox );
	snolGroupBox->setMargin( KDialog::marginHint() );

	label            = new QLabel( i18n( "Number of lines:" ), snolGroupBox );
	m_snolSpinBox    = new QSpinBox( 0, 50, 1, snolGroupBox );
	label->setBuddy( m_snolSpinBox );

	// Temporarily here for testing...
	// number of spaces for a tab character stuff
	tabGroupBox = new QHGroupBox( i18n( "Tabs to Spaces" ), page );
	layout->addWidget( tabGroupBox );
	tabGroupBox->setMargin( KDialog::marginHint() );

	label = new QLabel( i18n( "Number of spaces to convert a tab character to:" ), tabGroupBox );
	m_tabSpinBox = new QSpinBox( 1, 16, 1, tabGroupBox );
	label->setBuddy( m_tabSpinBox );

	layout->addStretch( 1 );
	page->setMinimumSize( sizeHintForWidget( page ) );

	addTab( page, i18n( "A&ppearance" ) );

	page   = new QWidget( this );
	layout = new QVBoxLayout( page );
	layout->setSpacing( KDialog::spacingHint() );
	layout->setMargin( KDialog::marginHint() );

	QHGroupBox* gb = new QHGroupBox( i18n( "Text Font" ), page );
	layout->addWidget( gb );
	gb->setMargin( KDialog::marginHint() );

	label = new QLabel( i18n( "Font:" ), gb );
	m_fontCombo = new KFontCombo( gb, "fontcombo" );
	label->setBuddy( m_fontCombo );

	label = new QLabel( i18n( "Size:" ), gb );
	m_fontSizeSpinBox = new QSpinBox( 6, 24, 1, gb, "fontsize" );
	label->setBuddy( m_fontSizeSpinBox );

	layout->addStretch( 1 );
	page->setMinimumSize( sizeHintForWidget( page ) );

	addTab( page, i18n( "&Fonts" ) );
}