예제 #1
0
파일: WSlider.C 프로젝트: DTidd/wt
void PaintedSlider::onSliderClick(const WMouseEvent& event)
{
  int x = event.widget().x;
  int y = event.widget().y;

  if (WApplication::instance()->layoutDirection() == RightToLeft)
    x = (int)(w() - x);

  onSliderReleased(slider_->orientation() == Horizontal ? x : y);
}
int SampleGraphicsViewApp::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: init(); break;
        case 1: zoom((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: onSliderPressed(); break;
        case 3: onSliderReleased(); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
예제 #3
0
        return;
    }

    disconnectWidgets();

    m_bInactive=true;
    setVisible(false);

    featureDisabled(this);
}

void DC1394Slider::connectWidgets()
{
    connect(ui->m_Slider,SIGNAL(valueChanged(int)),this,SLOT(onSliderValueChanged(int)));
    connect(ui->m_Slider,SIGNAL(sliderPressed()),this,SLOT(onSliderPressed()));
    connect(ui->m_Slider,SIGNAL(sliderReleased()),this,SLOT(onSliderReleased()));

    connect(ui->m_OnePush,SIGNAL(clicked()),this,SLOT(onOnePushClicked()));
    connect(ui->pRBa,SIGNAL(toggled(bool)),this,SLOT(onRadioAuto(bool)));
    //connect(ui->pRBm,SIGNAL(toggled(bool)),this,SLOT(onRadioManual(bool)));
    connect(ui->pPwr,SIGNAL(toggled(bool)),this,SLOT(onPower(bool)));
}

void DC1394Slider::disconnectWidgets()
{
    disconnect(ui->m_Slider,SIGNAL(valueChanged(int)),this,SLOT(onSliderValueChanged(int)));
    disconnect(ui->m_Slider,SIGNAL(sliderPressed()),this,SLOT(onSliderPressed()));
    disconnect(ui->m_Slider,SIGNAL(sliderReleased()),this,SLOT(onSliderReleased()));
    disconnect(ui->m_OnePush,SIGNAL(clicked()),this,SLOT(onOnePushClicked()));
    disconnect(ui->pRBa,SIGNAL(toggled(bool)),this,SLOT(onRadioAuto(bool)));
    //disconnect(ui->pRBm,SIGNAL(toggled(bool)),this,SLOT(onRadioManual(bool)));
예제 #4
0
bool Slider::onProcessMessage(Message* msg)
{
  switch (msg->type()) {

    case kFocusEnterMessage:
    case kFocusLeaveMessage:
      if (isEnabled())
        invalidate();
      break;

    case kMouseDownMessage:
      if (!isEnabled() || isReadOnly())
        return true;

      setSelected(true);
      captureMouse();

      {
        gfx::Point mousePos = static_cast<MouseMessage*>(msg)->position();
        slider_press_x = mousePos.x;
        slider_press_value = m_value;
        slider_press_left = static_cast<MouseMessage*>(msg)->left();
      }

      setupSliderCursor();

      // Fall through

    case kMouseMoveMessage:
      if (hasCapture()) {
        int value, accuracy, range;
        gfx::Rect rc = getChildrenBounds();
        gfx::Point mousePos = static_cast<MouseMessage*>(msg)->position();

        range = m_max - m_min + 1;

        // With left click
        if (slider_press_left) {
          value = m_min + range * (mousePos.x - rc.x) / rc.w;
        }
        // With right click
        else {
          accuracy = MID(1, rc.w / range, rc.w);

          value = slider_press_value +
            (mousePos.x - slider_press_x) / accuracy;
        }

        value = MID(m_min, value, m_max);

        if (m_value != value) {
          setValue(value);
          onChange();
        }

        return true;
      }
      break;

    case kMouseUpMessage:
      if (hasCapture()) {
        setSelected(false);
        releaseMouse();
        setupSliderCursor();

        onSliderReleased();
      }
      break;

    case kMouseEnterMessage:
    case kMouseLeaveMessage:
      // TODO theme stuff
      if (isEnabled())
        invalidate();
      break;

    case kKeyDownMessage:
      if (hasFocus() && !isReadOnly()) {
        int min = m_min;
        int max = m_max;
        int value = m_value;

        switch (static_cast<KeyMessage*>(msg)->scancode()) {
          case kKeyLeft:     value = MAX(value-1, min); break;
          case kKeyRight:    value = MIN(value+1, max); break;
          case kKeyPageDown: value = MAX(value-(max-min+1)/4, min); break;
          case kKeyPageUp:   value = MIN(value+(max-min+1)/4, max); break;
          case kKeyHome:     value = min; break;
          case kKeyEnd:      value = max; break;
          default:
            goto not_used;
        }

        if (m_value != value) {
          setValue(value);
          onChange();
        }

        return true;
      }
      break;

    case kMouseWheelMessage:
      if (isEnabled() && !isReadOnly()) {
        int value = m_value
          + static_cast<MouseMessage*>(msg)->wheelDelta().x
          - static_cast<MouseMessage*>(msg)->wheelDelta().y;

        value = MID(m_min, value, m_max);

        if (m_value != value) {
          this->setValue(value);
          onChange();
        }
        return true;
      }
      break;

    case kSetCursorMessage:
      setupSliderCursor();
      return true;
  }

not_used:;
  return Widget::onProcessMessage(msg);
}
예제 #5
0
Ui::CallPanelMain::CallPanelMain(QWidget* parent)
    : QWidget(parent)
    , _menu(NULL)
    , actual_vol_(0)
    , menu_show_(NULL)
    , name_and_status_container_(NULL)
    , avatar_container_(NULL) {

        setProperty("CallPanelMain", true);

        QVBoxLayout* root_layout = new QVBoxLayout();
        root_layout->setContentsMargins(0, 0, 0, 0);
        root_layout->setSpacing(0);
        root_layout->setAlignment(Qt::AlignVCenter);
        setLayout(root_layout);

        QWidget* rootWidget = new QWidget(this);
        rootWidget->setContentsMargins(0, 0, 0, 0);
        rootWidget->setProperty("CallPanelMain", true);
        layout()->addWidget(rootWidget);

        QHBoxLayout* layout = new QHBoxLayout();
        layout->setContentsMargins(0, 0, 0, 0);
        layout->setSpacing(0);
        layout->setAlignment(Qt::AlignVCenter);
        rootWidget->setLayout(layout);

        avatar_container_ = new AvatarContainerWidget(rootWidget, Utils::scale_value(50), Utils::scale_value(16), Utils::scale_value(12), Utils::scale_value(5));
        avatar_container_->setOverlap(0.6f);
        layout->addWidget(avatar_container_);

        name_and_status_container_ = new NameAndStatusWidget(rootWidget, Utils::scale_value(17), Utils::scale_value(12));
        name_and_status_container_->setNameProperty("CallPanelMainText_Name", true);
        name_and_status_container_->setStatusProperty("CallPanelMainText_Status", true);
        name_and_status_container_->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred));
        layout->addWidget(name_and_status_container_);

        layout->addSpacing(Utils::scale_value(6));

        menu_show_ = new QPushButton(rootWidget);
        menu_show_->setProperty("MenuShow", true);
		menu_show_->setCursor(QCursor(Qt::PointingHandCursor));
        connect(menu_show_, SIGNAL(clicked()), this, SLOT(onMenuButtonClicked()), Qt::QueuedConnection);
        layout->addWidget(menu_show_);

        layout->addSpacing(Utils::scale_value(24));

        QPushButton* callStop = new QPushButton(rootWidget);
        callStop->setProperty("StopCallMainButton", true);
		callStop->setCursor(QCursor(Qt::PointingHandCursor));
        connect(callStop, SIGNAL(clicked()), this, SLOT(onHangUpButtonClicked()), Qt::QueuedConnection);
        layout->addWidget(callStop);

        layout->addSpacing(Utils::scale_value(16));
        connect(&_menu, SIGNAL(onMenuOpenChanged(bool)), this, SLOT(onMenuOpenChanged(bool)), Qt::QueuedConnection);
        _menu.hide();

        QObject::connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallNameChanged(const std::vector<voip_manager::Contact>&)), this, SLOT(onVoipCallNameChanged(const std::vector<voip_manager::Contact>&)), Qt::DirectConnection);
        QObject::connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallDestroyed(const voip_manager::ContactEx&)), this, SLOT(onVoipCallDestroyed(const voip_manager::ContactEx&)), Qt::DirectConnection);
        QObject::connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipVolumeChanged(const std::string&,int)), this, SLOT(onVoipVolumeChanged(const std::string&,int)), Qt::DirectConnection);
        QObject::connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipMuteChanged(const std::string&,bool)), this, SLOT(onVoipMuteChanged(const std::string&,bool)), Qt::DirectConnection);
        QObject::connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipMediaLocalAudio(bool)), this, SLOT(onVoipMediaLocalAudio(bool)), Qt::DirectConnection);
        QObject::connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipMediaLocalVideo(bool)), this, SLOT(onVoipMediaLocalVideo(bool)), Qt::DirectConnection);
		QObject::connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallTimeChanged(unsigned,bool)), this, SLOT(onVoipCallTimeChanged(unsigned,bool)), Qt::DirectConnection);

        {
            SliderEx* slider = new SliderEx(&_menu);
            slider->setProperty("CallMenuItemCommon", true);
            slider->set_property_for_slider("VideoPanelVolumeSlider", true);
            slider->set_property_for_icon("CallMenuItemButton", true);

            _menu.add_widget(kmenu_item_volume, slider);
            connect(slider, SIGNAL(onSliderValueChanged(int)), this, SLOT(onVolumeChanged(int)), Qt::QueuedConnection);
            connect(slider, SIGNAL(onSliderReleased()), this, SLOT(onVolumeReleased()), Qt::QueuedConnection);
            connect(slider, SIGNAL(onIconClick()), this, SLOT(onVolumeOnOff()), Qt::QueuedConnection);
        }
        
        {
            QPushButton* btn = new QPushButton(&_menu);
            btn->setProperty("CallMenuItemCommon", true);
            btn->setProperty("CallMenuItemButton", true);
			btn->setCursor(QCursor(Qt::PointingHandCursor));
            _menu.add_widget(kmenu_item_mic, btn);
            connect(btn, SIGNAL(clicked()), this, SLOT(onMuteMicOnOffClicked()), Qt::QueuedConnection);
        }
        
        {
            QPushButton* btn = new QPushButton(&_menu);
            btn->setProperty("CallMenuItemCommon", true);
            btn->setProperty("CallMenuItemButton", true);
			btn->setCursor(QCursor(Qt::PointingHandCursor));
            _menu.add_widget(kmenu_item_cam, btn);
            connect(btn, SIGNAL(clicked()), this, SLOT(onVideoOnOffClicked()), Qt::QueuedConnection);
        }
}
예제 #6
0
void Ui::SliderEx::onVolumeReleased() {
    emit onSliderReleased();
}
void MusicWidget::setupGUI()
{
    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addSpacing(10);

    m_playlistView = new QTableWidget();
    RowDelegate *rowDelegate = new RowDelegate(this);
    m_playlistView->setItemDelegate(rowDelegate);
    m_playlistView->setStyleSheet(PLAYLIST_VIEW_STYLE);
    m_playlistView->setSelectionMode(QAbstractItemView::SingleSelection);
    m_playlistView->setSelectionBehavior(QAbstractItemView::SelectRows);
    m_playlistView->setVerticalScrollMode(QAbstractItemView::ScrollPerItem);
    m_playlistView->setEditTriggers(QAbstractItemView::NoEditTriggers);
    m_playlistView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_playlistView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_playlistView->setShowGrid(false);
    layout->addWidget(m_playlistView);
    connect(m_playlistView, SIGNAL(cellClicked(int,int))
            , this, SLOT(onCellClicked(int,int)));
    layout->addSpacing(4);

    m_currentSongLabel = new QLabel();
    m_currentSongLabel->setStyleSheet(CURRENT_LABEL_STYLE);
    layout->addWidget(m_currentSongLabel);

    QSize buttonSize(41, 33);
    m_playModeButton = new QPushButton(g_playmodeTexts[QMediaPlaylist::Loop], this);
    m_playModeButton->adjustSize();
#ifdef ANDROID
    QSize screenSize = qApp->primaryScreen()->size();
    if(screenSize.width() > 960 || screenSize.height() > 960)
    {
        buttonSize *= (m_playModeButton->height() / 33);
    }
#endif
    QHBoxLayout * controlLayout = new QHBoxLayout;
    controlLayout->setSpacing(4);
    layout->addLayout(controlLayout);
    controlLayout->addStretch(1);
    m_folderButton = new ImageButton(QPixmap(":/images/openfile.png")
                                     , QPixmap(":/images/openfile_down.png"));
    connect(m_folderButton, SIGNAL(clicked()), this, SIGNAL(selectSong()));
    m_folderButton->setFixedSize(buttonSize);
    controlLayout->addWidget(m_folderButton);

    m_prevButton = new ImageButton(QPixmap(":/images/preSong.png"),
                                   QPixmap(":/images/preSong_down.png"));
    m_prevButton->setFixedSize(buttonSize);
    connect(m_prevButton, SIGNAL(clicked()), m_playlist, SLOT(previous()));
    controlLayout->addWidget(m_prevButton);

    m_playpauseButton = new ImageButton(QPixmap(":/images/playpause.png")
                                        ,QPixmap(":/images/playpause_down.png"));
    m_playpauseButton->setFixedSize(buttonSize);
    connect(m_playpauseButton, SIGNAL(clicked()), this, SLOT(onPlayPauseButton()));
    controlLayout->addWidget(m_playpauseButton);

    m_stopButton = new ImageButton(QPixmap(":/images/stop.png")
                                   , QPixmap(":/images/stop_down.png"));
    m_stopButton->setFixedSize(buttonSize);
    connect(m_stopButton, SIGNAL(clicked()), this, SLOT(onStopButton()));
    controlLayout->addWidget(m_stopButton);

    m_nextButton = new ImageButton(QPixmap(":/images/nextSong.png")
                                   , QPixmap(":/images/nextSong_down.png"));
    m_nextButton->setFixedSize(buttonSize);
    connect(m_nextButton, SIGNAL(clicked()), m_playlist, SLOT(next()));
    controlLayout->addWidget(m_nextButton);

    QCheckBox *muteBox = new QCheckBox();
    muteBox->setStyleSheet(MUTE_CHECKBOX_STYLE);
    connect(muteBox, SIGNAL(stateChanged(int)),
            this, SLOT(onMuteButtonStateChanged(int)));
    controlLayout->addWidget(muteBox);

    connect(m_playModeButton, SIGNAL(clicked()),
            this, SLOT(onPlayModeButton()));
    controlLayout->addWidget(m_playModeButton);

    controlLayout->addStretch(1);

    QGridLayout *progressLayout = new QGridLayout();
    layout->addLayout(progressLayout);
    m_playProgress = new QSlider(Qt::Horizontal);
    //m_playProgress->setFixedWidth(280);
    m_playProgress->setStyleSheet(SLIDER_STYLE);
    progressLayout->addWidget(m_playProgress, 0, 0, 1, 2);
    connect(m_playProgress, SIGNAL(sliderPressed()),
            this, SLOT(onSliderPressed()));
    connect(m_playProgress, SIGNAL(sliderReleased()),
            this, SLOT(onSliderReleased()));
    m_positionLabel = new QLabel();
    m_positionLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
    progressLayout->addWidget(m_positionLabel, 1, 0, Qt::AlignLeft | Qt::AlignTop);
    m_durationLabel = new QLabel();
    m_durationLabel->setAlignment(Qt::AlignRight | Qt::AlignTop);
    progressLayout->addWidget(m_durationLabel, 1, 1, Qt::AlignRight | Qt::AlignTop);
}