28 #include <QButtonGroup>
30 #include <QRadioButton>
31 #include <QVBoxLayout>
36 setCaption( i18n(
"Configure Picture of the Day" ) );
37 setButtons( Ok|Cancel );
38 setDefaultButton( Ok );
41 setMainWidget( topFrame );
42 QVBoxLayout *topLayout =
new QVBoxLayout( topFrame );
43 topLayout->setSpacing( spacingHint() );
44 topLayout->setMargin( 0 );
46 QGroupBox *aspectRatioBox =
new QGroupBox( i18n(
"Thumbnail Aspect Ratio Mode" ), topFrame );
47 topLayout->addWidget( aspectRatioBox );
48 QVBoxLayout *groupLayout =
new QVBoxLayout( aspectRatioBox );
51 mAspectRatioGroup =
new QButtonGroup(
this );
52 btn =
new QRadioButton( i18n(
"Ignore aspect ratio" ), aspectRatioBox );
53 btn->setWhatsThis( i18n(
"The thumbnail will be scaled freely. "
54 "The aspect ratio will not be preserved." ) );
55 mAspectRatioGroup->addButton( btn,
int( Qt::IgnoreAspectRatio ) );
56 groupLayout->addWidget( btn );
57 btn =
new QRadioButton( i18n(
"Keep aspect ratio" ), aspectRatioBox );
58 btn->setWhatsThis( i18n(
"The thumbnail will be scaled to a rectangle "
59 "as large as possible inside a given rectangle, "
60 "preserving the aspect ratio." ) );
61 mAspectRatioGroup->addButton( btn,
int( Qt::KeepAspectRatio ) );
62 groupLayout->addWidget( btn );
63 btn =
new QRadioButton( i18n(
"Keep aspect ratio by expanding" ),
65 btn->setWhatsThis( i18n(
"The thumbnail will be scaled to a rectangle "
66 "as small as possible outside a given rectangle, "
67 "preserving the aspect ratio." ) );
68 mAspectRatioGroup->addButton( btn,
int( Qt::KeepAspectRatioByExpanding ) );
69 groupLayout->addWidget( btn );
71 connect(
this, SIGNAL(okClicked()),
this, SLOT(
slotOk()) );
82 KConfig _config( QLatin1String(
"korganizerrc"), KConfig::NoGlobals );
83 KConfigGroup config( &_config,
"Calendar/Picoftheday Plugin" );
84 int datenum = config.readEntry(
"AspectRatioMode", 0 );
85 QAbstractButton *btn = mAspectRatioGroup->button( datenum );
87 btn = mAspectRatioGroup->button( 0 );
89 btn->setChecked(
true );
94 KConfig _config( QLatin1String(
"korganizerrc"), KConfig::NoGlobals );
95 KConfigGroup config( &_config,
"Calendar/Picoftheday Plugin" );
96 config.writeEntry(
"AspectRatioMode", mAspectRatioGroup->checkedId() );
106 #include "configdialog.moc"
ConfigDialog(QWidget *parent=0)