void Moto::initGui() { ui.statusbar->showMessage( "Press F1 for help" ); ui.speed_msr->setLabel( "x100" ); ui.software->setEnabled( false ); slotClosed(); lockConfig(); loadSettings(); connect( this, SIGNAL(sigSpeed()), this, SLOT(slotSpeed()) ); connect( this, SIGNAL(sigStatus()), this, SLOT(slotStatus()) ); connect( this, SIGNAL(sigConfig()), this, SLOT(slotConfig()) ); connect( this, SIGNAL(sigOpened()), this, SLOT(slotOpened()) ); connect( this, SIGNAL(sigClosed()), this, SLOT(slotClosed()) ); // Binding GUI controls. connect( ui.throttle, SIGNAL(valueChanged(int)), this, SLOT(slotThrottleChanged(int)) ); connect( ui.speed, SIGNAL(valueChanged(int)), this, SLOT(slotSpeedChanged(int)) ); connect( ui.direction, SIGNAL(currentIndexChanged(int)), this, SLOT(slotDirectionChanged(int)) ); connect( ui.unlock, SIGNAL(clicked()), this, SLOT(slotUnlock()) ); connect( ui.apply, SIGNAL(clicked()), this, SLOT(slotApply()) ); connect( ui.help, SIGNAL(triggered()), this, SLOT(slotHelp()) ); m_speedTimer = new QTimer(); m_statusTimer = new QTimer(); connect( m_speedTimer, SIGNAL(timeout()), this, SLOT(slotSpeedTimeout()) ); connect( m_statusTimer, SIGNAL(timeout()), this, SLOT(slotStatusTimeout()) ); m_speedTimer->setInterval( 100 ); m_statusTimer->setInterval( 1000 ); m_speedTimer->start(); m_statusTimer->start(); }
CScrollerWidgetSet::CScrollerWidgetSet(QWidget *parent) : QWidget(parent) { m_layout = new QVBoxLayout(this); m_layout->setSpacing(0); m_layout->setContentsMargins(0,0,0,0); m_layout->setAlignment(this, Qt::AlignHCenter | Qt::AlignCenter); //setAlignment(Qt::AlignHCenter | Qt::AlignCenter); //TODO: old constructor gave "name" argument, is that needed? "btn_up" etc. btn_up = new QToolButton(this); btn_up->setArrowType(Qt::UpArrow); btn_up->setFixedSize(WIDTH, ARROW_HEIGHT); btn_up->setFocusPolicy(Qt::NoFocus); btn_up->setAutoRaise(true); btn_fx = new CScrollButton(this); btn_fx->setFixedSize(WIDTH, MOVER_HEIGHT); btn_fx->setFocusPolicy(Qt::NoFocus); btn_down = new QToolButton(this); btn_down->setArrowType(Qt::DownArrow); btn_down->setFixedSize(WIDTH, ARROW_HEIGHT); btn_down->setFocusPolicy(Qt::NoFocus); btn_down->setAutoRaise(true); m_layout->addWidget( btn_up,0 ); m_layout->addWidget( btn_fx,0 ); m_layout->addWidget( btn_down,0 ); setMinimumWidth(WIDTH); // Kludge to add some spacing but seems to work. connect(btn_fx, SIGNAL(lock()), SLOT(slotLock())); connect(btn_fx, SIGNAL(unlock()), SLOT(slotUnlock())); connect(btn_fx, SIGNAL(change_requested(int)), SLOT(slotScroller(int))); connect(btn_up, SIGNAL(clicked()), SLOT(slotUpClick())); connect(btn_down, SIGNAL(clicked()), SLOT(slotDownClick())); }