usability++

see "kwin's KCM usability" mail.

svn path=/trunk/KDE/kdebase/workspace/; revision=871309
This commit is contained in:
Davide Bettio 2008-10-14 13:23:50 +00:00
parent c12172d291
commit ae957480a0
3 changed files with 95 additions and 44 deletions

View file

@ -33,6 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kservicetypetrader.h>
#include <kplugininfo.h>
#include <kservice.h>
#include <ktitlewidget.h>
#include <QtDBus/QtDBus>
#include <QTimer>
@ -75,7 +76,7 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
ui.setupUi(this);
layout()->setMargin(0);
ui.tabWidget->setCurrentIndex(0);
ui.statusLabel->hide();
ui.statusTitleWidget->hide();
connect(ui.advancedOptions, SIGNAL(clicked()), this, SLOT(showAdvancedOptions()));
connect(ui.useCompositing, SIGNAL(toggled(bool)), this, SLOT(compositingEnabled(bool)));
@ -118,10 +119,11 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
compositingEnabled(false);
QString text = i18n("Compositing is not supported on your system.");
text += "<br><br>";
text += "<br>";
text += CompositingPrefs::compositingNotPossibleReason();
ui.statusLabel->setText(text);
ui.statusLabel->show();
ui.statusTitleWidget->setText(text);
ui.statusTitleWidget->setPixmap(KTitleWidget::InfoMessage, KTitleWidget::ImageLeft);
ui.statusTitleWidget->show();
}
KAboutData *about = new KAboutData(I18N_NOOP("kcmkwincompositing"), 0,

View file

@ -16,18 +16,13 @@
<number>0</number>
</property>
<widget class="QWidget" name="tab" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>585</width>
<height>618</height>
</rect>
</property>
<attribute name="title" >
<string>General</string>
</attribute>
<layout class="QVBoxLayout" >
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<widget class="KTitleWidget" name="statusTitleWidget" />
</item>
<item>
<widget class="QCheckBox" name="useCompositing" >
<property name="text" >
@ -80,7 +75,10 @@
<item row="3" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Effect for window switching</string>
<string>Effect for window switching:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>windowSwitchingCombo</cstring>
@ -88,12 +86,22 @@
</widget>
</item>
<item row="3" column="1" >
<widget class="QComboBox" name="windowSwitchingCombo" />
<widget class="QComboBox" name="windowSwitchingCombo" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Effect for desktop switching</string>
<string>Effect for desktop switching:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>desktopSwitchingCombo</cstring>
@ -101,9 +109,16 @@
</widget>
</item>
<item row="4" column="1" >
<widget class="QComboBox" name="desktopSwitchingCombo" />
<widget class="QComboBox" name="desktopSwitchingCombo" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2" >
<item row="7" column="0" colspan="2" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>You can find more effects in the 'All Effects' tab</string>
@ -112,6 +127,12 @@
</item>
<item row="5" column="1" >
<widget class="QComboBox" name="animationSpeedCombo" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex" >
<number>3</number>
</property>
@ -155,11 +176,41 @@
<item row="5" column="0" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Animation speed</string>
<string>Animation speed:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="0" >
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
</layout>
<zorder>effectWinManagement</zorder>
<zorder>effectShadows</zorder>
<zorder>effectAnimations</zorder>
<zorder>label_3</zorder>
<zorder>windowSwitchingCombo</zorder>
<zorder>label_4</zorder>
<zorder>desktopSwitchingCombo</zorder>
<zorder>label</zorder>
<zorder>animationSpeedCombo</zorder>
<zorder>label_5</zorder>
<zorder>verticalSpacer</zorder>
</widget>
</item>
<item>
@ -189,9 +240,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="statusLabel" />
</item>
<item>
<spacer>
<property name="orientation" >
@ -208,14 +256,6 @@
</layout>
</widget>
<widget class="QWidget" name="tab_2" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>591</width>
<height>619</height>
</rect>
</property>
<attribute name="title" >
<string>All Effects</string>
</attribute>
@ -242,8 +282,14 @@
</widget>
</item>
</layout>
<zorder>tabWidget</zorder>
</widget>
<customwidgets>
<customwidget>
<class>KTitleWidget</class>
<extends>QWidget</extends>
<header>ktitlewidget.h</header>
</customwidget>
<customwidget>
<class>KPluginSelector</class>
<extends>QWidget</extends>

View file

@ -71,15 +71,12 @@ KDesktopConfig::KDesktopConfig(QWidget *parent, const QVariantList &)
layout->setMargin(0);
layout->setSpacing(KDialog::spacingHint());
// number group
QGroupBox *number_group = new QGroupBox(this);
QHBoxLayout *lay = new QHBoxLayout(number_group);
QHBoxLayout *lay = new QHBoxLayout();
lay->setMargin(KDialog::marginHint());
lay->setSpacing(KDialog::spacingHint());
QLabel *label = new QLabel(i18n("N&umber of desktops: "), number_group);
_numInput = new KIntNumInput(4, number_group);
QLabel *label = new QLabel(i18n("N&umber of desktops: "), this);
_numInput = new KIntNumInput(4, this);
_numInput->setRange(1, maxDesktops, 1);
connect(_numInput, SIGNAL(valueChanged(int)), SLOT(slotValueChanged(int)));
connect(_numInput, SIGNAL(valueChanged(int)), SLOT( changed() ));
@ -87,29 +84,31 @@ KDesktopConfig::KDesktopConfig(QWidget *parent, const QVariantList &)
QString wtstr = i18n( "Here you can set how many virtual desktops you want on your KDE desktop. Move the slider to change the value." );
label->setWhatsThis( wtstr );
_numInput->setWhatsThis( wtstr );
QSpacerItem *horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
lay->addWidget(label);
lay->addWidget(_numInput);
lay->setStretchFactor( _numInput, 2 );
lay->addItem(horizontalSpacer);
//lay->setStretchFactor( _numInput, 2 );
layout->addWidget(number_group);
layout->addLayout(lay);
// name group
QGroupBox *name_group = new QGroupBox(i18n("Desktop &Names"), this);
QFormLayout *namesLayout = new QFormLayout;
QGridLayout *namesLayout = new QGridLayout;
name_group->setLayout(namesLayout);
QFontMetrics fm(label->font());
int labelWidth = fm.width(i18n("Desktop %1:", 10)); // be sure that all label will have the same width (with one or two numbers, e.g. 1, 99)
for(int i = 0; i < maxDesktops; i++)
{
_nameLabel[i] = new QLabel(i18n("Desktop %1:", i+1), name_group);
_nameInput[i] = new KLineEdit(name_group);
_nameLabel[i]->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
_nameLabel[i]->setWhatsThis( i18n( "Here you can enter the name for desktop %1", i+1 ) );
_nameInput[i]->setWhatsThis( i18n( "Here you can enter the name for desktop %1", i+1 ) );
connect(_nameInput[i], SIGNAL(textChanged(const QString&)),
SLOT( changed() ));
namesLayout->addRow(_nameLabel[i],_nameInput[i]);
namesLayout->addWidget(_nameLabel[i], i, 0, 1, 1);
namesLayout->addWidget(_nameInput[i], i, 1, 1, 1);
}
for(int i = 1; i < maxDesktops; i++)
@ -143,14 +142,18 @@ KDesktopConfig::KDesktopConfig(QWidget *parent, const QVariantList &)
if (config->isGroupImmutable(groupname))
{
name_group->setEnabled(false);
number_group->setEnabled(false);
//number of desktops widgets
label->setEnabled(false);
_numInput->setEnabled(false);
}
else
{
KConfigGroup cfgGroup(config.data(), groupname.constData());
if (cfgGroup.isEntryImmutable("Number"))
{
number_group->setEnabled(false);
//number of desktops widgets
label->setEnabled(false);
_numInput->setEnabled(false);
}
}
// End check for immutable