- Update the preview on button position/border size setting changes. Preview of
settings in the decoration's config dialogs isn't available yet. - Move the decoration combobox and the preview out of the tab widget to be visible from all tabs - makes the new preview update more useful. CCBUG:70349 svn path=/trunk/kdebase/kwin/; revision=364647
This commit is contained in:
parent
42c0e144c1
commit
fafe39943f
4 changed files with 56 additions and 18 deletions
|
@ -71,37 +71,46 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const char* name, co
|
|||
kwinConfig.setGroup("Style");
|
||||
plugins = new KDecorationPreviewPlugins( &kwinConfig );
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
tabWidget = new QTabWidget( this );
|
||||
layout->addWidget( tabWidget );
|
||||
QVBoxLayout* layout = new QVBoxLayout(this, 0, KDialog::spacingHint());
|
||||
|
||||
// Page 1 (General Options)
|
||||
QWidget *pluginPage = new QWidget( tabWidget );
|
||||
QHBoxLayout *listLayout = new QHBoxLayout(layout);
|
||||
|
||||
QHBox *hbox = new QHBox(pluginPage);
|
||||
hbox->setSpacing(KDialog::spacingHint());
|
||||
// QLabel *lbl = new QLabel( i18n("&Decoration:"), hbox );
|
||||
decorationList = new KComboBox( hbox );
|
||||
// lbl->setBuddy(decorationList);
|
||||
QLabel *lbl = new QLabel( i18n("&Decoration:"), this );
|
||||
decorationList = new KComboBox( this );
|
||||
lbl->setBuddy(decorationList);
|
||||
QString whatsThis = i18n("Select the window decoration. This is the look and feel of both "
|
||||
"the window borders and the window handle.");
|
||||
// QWhatsThis::add(lbl, whatsThis);
|
||||
QWhatsThis::add(lbl, whatsThis);
|
||||
QWhatsThis::add(decorationList, whatsThis);
|
||||
|
||||
QVBoxLayout* pluginLayout = new QVBoxLayout(pluginPage, KDialog::marginHint(), KDialog::spacingHint());
|
||||
pluginLayout->addWidget(hbox);
|
||||
listLayout->addWidget(lbl);
|
||||
listLayout->addWidget(decorationList);
|
||||
listLayout->addStretch();
|
||||
|
||||
// Save this for later...
|
||||
// cbUseMiniWindows = new QCheckBox( i18n( "Render mini &titlebars for all windows"), checkGroup );
|
||||
// QWhatsThis::add( cbUseMiniWindows, i18n( "Note that this option is not available on all styles yet!" ) );
|
||||
|
||||
QFrame* preview_frame = new QFrame( pluginPage );
|
||||
QVBoxLayout* previewLayout = new QVBoxLayout(layout, KDialog::spacingHint());
|
||||
|
||||
QFrame* preview_frame = new QFrame( this );
|
||||
preview_frame->setFrameShape( QFrame::NoFrame );
|
||||
QVBoxLayout* preview_layout = new QVBoxLayout( preview_frame, 0 );
|
||||
preview = new KDecorationPreview( preview_frame );
|
||||
preview_layout->addWidget( preview );
|
||||
pluginLayout->addWidget( preview_frame );
|
||||
pluginLayout->setStretchFactor( preview_frame, 10 );
|
||||
previewLayout->addWidget( preview_frame );
|
||||
previewLayout->setStretchFactor( preview_frame, 10 );
|
||||
|
||||
tabWidget = new QTabWidget( this );
|
||||
layout->addWidget( tabWidget );
|
||||
|
||||
preview_frame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
tabWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
|
||||
|
||||
// Page 1 (General Options)
|
||||
QWidget *pluginPage = new QWidget( tabWidget );
|
||||
|
||||
QVBoxLayout* pluginLayout = new QVBoxLayout(pluginPage, KDialog::marginHint(), KDialog::spacingHint());
|
||||
|
||||
pluginSettingsGrp = new QGroupBox( i18n("Decoration Options"), pluginPage );
|
||||
pluginSettingsGrp->setColumnLayout( 0, Vertical );
|
||||
|
@ -109,6 +118,7 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const char* name, co
|
|||
pluginSettingsGrp->layout()->setMargin( 0 );
|
||||
pluginSettingsGrp->layout()->setSpacing( KDialog::spacingHint() );
|
||||
pluginLayout->addWidget( pluginSettingsGrp );
|
||||
pluginLayout->addStretch();
|
||||
|
||||
pluginConfigWidget = new QVBox(pluginSettingsGrp);
|
||||
pluginSettingsGrp->layout()->add( pluginConfigWidget );
|
||||
|
@ -171,12 +181,14 @@ KWinDecorationModule::KWinDecorationModule(QWidget* parent, const char* name, co
|
|||
connect( dropSite, SIGNAL(buttonRemoved(char)), buttonSource, SLOT(showButton(char)) );
|
||||
connect( buttonSource, SIGNAL(buttonDropped()), dropSite, SLOT(removeClickedButton()) );
|
||||
connect( dropSite, SIGNAL(changed()), this, SLOT(slotSelectionChanged()) );
|
||||
connect( dropSite, SIGNAL(changed()), this, SLOT(slotButtonsChanged()) );
|
||||
connect( buttonSource, SIGNAL(selectionChanged()), this, SLOT(slotSelectionChanged()) );
|
||||
connect( decorationList, SIGNAL(activated(const QString&)), SLOT(slotSelectionChanged()) );
|
||||
connect( decorationList, SIGNAL(activated(const QString&)),
|
||||
SLOT(slotChangeDecoration(const QString&)) );
|
||||
connect( cbUseCustomButtonPositions, SIGNAL(clicked()), SLOT(slotSelectionChanged()) );
|
||||
connect(cbUseCustomButtonPositions, SIGNAL(toggled(bool)), buttonBox, SLOT(setEnabled(bool)));
|
||||
connect(cbUseCustomButtonPositions, SIGNAL(toggled(bool)), this, SLOT(slotButtonsChanged()) );
|
||||
connect( cbShowToolTips, SIGNAL(clicked()), SLOT(slotSelectionChanged()) );
|
||||
connect( slBorder, SIGNAL( valueChanged( int )), SLOT( slotBorderChanged( int )));
|
||||
// connect( cbUseMiniWindows, SIGNAL(clicked()), SLOT(slotSelectionChanged()) );
|
||||
|
@ -312,6 +324,15 @@ void KWinDecorationModule::slotBorderChanged( int size )
|
|||
assert( sizes.count() >= 2 );
|
||||
border_size = indexToBorderSize( size, sizes );
|
||||
lBorder->setText( i18n( border_names[ border_size ] ));
|
||||
|
||||
// update preview
|
||||
preview->setTempBorderSize(plugins, border_size);
|
||||
}
|
||||
|
||||
void KWinDecorationModule::slotButtonsChanged()
|
||||
{
|
||||
// update preview
|
||||
preview->setTempButtons(plugins, cbUseCustomButtonPositions->isChecked(), dropSite->buttonsLeft, dropSite->buttonsRight );
|
||||
}
|
||||
|
||||
QString KWinDecorationModule::decorationName( QString& libName )
|
||||
|
|
|
@ -84,6 +84,7 @@ class KWinDecorationModule : public KCModule, virtual public KWinDecorationIface
|
|||
void slotSelectionChanged();
|
||||
void slotChangeDecoration( const QString & );
|
||||
void slotBorderChanged( int );
|
||||
void slotButtonsChanged();
|
||||
|
||||
private:
|
||||
void readConfig( KConfig* conf );
|
||||
|
|
|
@ -190,8 +190,9 @@ void KDecorationPreview::setTempBorderSize(KDecorationPlugins* plugin, KDecorati
|
|||
}
|
||||
}
|
||||
|
||||
void KDecorationPreview::setTempButtons(KDecorationPlugins* plugin, const QString &left, const QString &right)
|
||||
void KDecorationPreview::setTempButtons(KDecorationPlugins* plugin, bool customEnabled, const QString &left, const QString &right)
|
||||
{
|
||||
options->setCustomTitleButtonsEnabled(customEnabled);
|
||||
options->setCustomTitleButtons(left, right);
|
||||
if (plugin->factory()->reset(KDecorationDefines::SettingButtons) )
|
||||
{
|
||||
|
@ -426,6 +427,8 @@ void KDecorationPreviewBridge::grabXServer( bool )
|
|||
KDecorationPreviewOptions::KDecorationPreviewOptions()
|
||||
{
|
||||
customBorderSize = BordersCount; // invalid
|
||||
customButtonsChanged = false; // invalid
|
||||
customButtons = true;
|
||||
customTitleButtonsLeft = QString::null; // invalid
|
||||
customTitleButtonsRight = QString::null; // invalid
|
||||
|
||||
|
@ -448,6 +451,8 @@ unsigned long KDecorationPreviewOptions::updateSettings()
|
|||
// set custom border size/buttons
|
||||
if (customBorderSize != BordersCount)
|
||||
d->border_size = customBorderSize;
|
||||
if (customButtonsChanged)
|
||||
d->custom_button_positions = customButtons;
|
||||
if (!customTitleButtonsLeft.isNull() )
|
||||
d->title_buttons_left = customTitleButtonsLeft;
|
||||
if (!customTitleButtonsRight.isNull() )
|
||||
|
@ -463,6 +468,14 @@ void KDecorationPreviewOptions::setCustomBorderSize(BorderSize size)
|
|||
updateSettings();
|
||||
}
|
||||
|
||||
void KDecorationPreviewOptions::setCustomTitleButtonsEnabled(bool enabled)
|
||||
{
|
||||
customButtonsChanged = true;
|
||||
customButtons = enabled;
|
||||
|
||||
updateSettings();
|
||||
}
|
||||
|
||||
void KDecorationPreviewOptions::setCustomTitleButtons(const QString &left, const QString &right)
|
||||
{
|
||||
customTitleButtonsLeft = left;
|
||||
|
|
|
@ -48,7 +48,7 @@ class KDecorationPreview
|
|||
QRegion unobscuredRegion( bool, const QRegion& ) const;
|
||||
QRect windowGeometry( bool ) const;
|
||||
void setTempBorderSize(KDecorationPlugins* plugin, KDecorationDefines::BorderSize size);
|
||||
void setTempButtons(KDecorationPlugins* plugin, const QString &left, const QString &right);
|
||||
void setTempButtons(KDecorationPlugins* plugin, bool customEnabled, const QString &left, const QString &right);
|
||||
protected:
|
||||
virtual void resizeEvent( QResizeEvent* );
|
||||
private:
|
||||
|
@ -121,10 +121,13 @@ class KDecorationPreviewOptions
|
|||
virtual unsigned long updateSettings();
|
||||
|
||||
void setCustomBorderSize(BorderSize size);
|
||||
void setCustomTitleButtonsEnabled(bool enabled);
|
||||
void setCustomTitleButtons(const QString &left, const QString &right);
|
||||
|
||||
private:
|
||||
BorderSize customBorderSize;
|
||||
bool customButtonsChanged;
|
||||
bool customButtons;
|
||||
QString customTitleButtonsLeft;
|
||||
QString customTitleButtonsRight;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue