File indexing completed on 2024-05-19 05:35:22

0001 //////////////////////////////////////////////////////////////////////////////
0002 // oxygenfollowmouseanimationconfigitem.cpp
0003 // animation configuration item
0004 // -------------------
0005 //
0006 // SPDX-FileCopyrightText: 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr>
0007 //
0008 // SPDX-License-Identifier: MIT
0009 //////////////////////////////////////////////////////////////////////////////
0010 
0011 #include "oxygenfollowmouseanimationconfigitem.h"
0012 #include "ui_oxygenfollowmouseanimationconfigbox.h"
0013 
0014 namespace Oxygen
0015 {
0016 //_______________________________________________
0017 FollowMouseAnimationConfigBox::FollowMouseAnimationConfigBox(QWidget *parent)
0018     : QFrame(parent)
0019     , ui(new Ui_FollowMouseAnimationConfigBox())
0020 {
0021     ui->setupUi(this);
0022     ui->followMouseDurationSpinBox->setEnabled(false);
0023     connect(ui->typeComboBox, SIGNAL(currentIndexChanged(int)), SLOT(typeChanged(int)));
0024 }
0025 
0026 //_______________________________________________
0027 FollowMouseAnimationConfigBox::~FollowMouseAnimationConfigBox(void)
0028 {
0029     delete ui;
0030 }
0031 
0032 //_______________________________________________
0033 KComboBox *FollowMouseAnimationConfigBox::typeComboBox(void) const
0034 {
0035     return ui->typeComboBox;
0036 }
0037 
0038 //_______________________________________________
0039 QSpinBox *FollowMouseAnimationConfigBox::durationSpinBox(void) const
0040 {
0041     return ui->durationSpinBox;
0042 }
0043 
0044 //_______________________________________________
0045 QLabel *FollowMouseAnimationConfigBox::durationLabel(void) const
0046 {
0047     return ui->durationLabel;
0048 }
0049 
0050 //_______________________________________________
0051 QSpinBox *FollowMouseAnimationConfigBox::followMouseDurationSpinBox(void) const
0052 {
0053     return ui->followMouseDurationSpinBox;
0054 }
0055 
0056 //_______________________________________________
0057 void FollowMouseAnimationConfigBox::typeChanged(int value)
0058 {
0059     ui->followMouseDurationLabel->setEnabled(value == 1);
0060     ui->followMouseDurationSpinBox->setEnabled(value == 1);
0061 }
0062 
0063 //_______________________________________________
0064 void FollowMouseAnimationConfigItem::initializeConfigurationWidget(QWidget *parent)
0065 {
0066     Q_ASSERT(!_configurationWidget);
0067     _configurationWidget = new FollowMouseAnimationConfigBox(parent);
0068     setConfigurationWidget(_configurationWidget.data());
0069 
0070     connect(_configurationWidget.data()->typeComboBox(), SIGNAL(currentIndexChanged(int)), SIGNAL(changed()));
0071     connect(_configurationWidget.data()->durationSpinBox(), SIGNAL(valueChanged(int)), SIGNAL(changed()));
0072     connect(_configurationWidget.data()->followMouseDurationSpinBox(), SIGNAL(valueChanged(int)), SIGNAL(changed()));
0073 }
0074 }